IDA Domain
xref.hpp
Go to the documentation of this file.
1 #ifndef IDA_DOMAIN_XREF_HPP
2 #define IDA_DOMAIN_XREF_HPP
3 
5 #include <kernwin.hpp>
6 #include <xref.hpp>
7 #include <vector>
8 #include <memory>
9 
10 #ifndef SWIG
12 {
13 #endif
14  class Database;
15 
17  class IDA_API Xrefs
18  {
20  const Database &m_database;
21 
23  Xrefs() = delete;
24 
25  public:
28  {
29  protected:
32 
34  const ea_t m_ea;
35 
37  xrefblk_t m_xrefblk;
38 
40  Iterator(const Database &database, const ea_t ea) : m_database(database), m_ea(ea)
41  {
42  }
43  };
44 
46  class IDA_API ToIterator : public Iterator
47  {
49  ToIterator() = delete;
50 
51  public:
55  ToIterator(const Database &database, const ea_t ea) : Iterator(database, ea)
56  {
57  }
58 
61  std::pair<bool, xrefblk_t> get_first();
62 
65  std::pair<bool, xrefblk_t> get_next();
66  };
67 
69  class IDA_API FromIterator : public Iterator
70  {
72  FromIterator() = delete;
73 
74  public:
78  FromIterator(const Database &database, const ea_t ea) : Iterator(database, ea)
79  {
80  }
81 
84  std::pair<bool, xrefblk_t> get_first();
85 
88  std::pair<bool, xrefblk_t> get_next();
89  };
90 
91  public:
94  Xrefs(const Database &database) : m_database(database)
95  {
96  }
97 
101  ToIterator get_to(const ea_t ea) const
102  {
103  return ToIterator(m_database, ea);
104  }
105 
109  FromIterator get_from(const ea_t ea) const
110  {
111  return FromIterator(m_database, ea);
112  }
113  };
114 #ifndef SWIG
115 }
116 #endif
117 
118 #endif // IDA_DOMAIN_XREF_HPP
Provides access and control over the loaded IDA database.
Definition: database.hpp:25
Iterator for outgoing cross-references (from the specified address).
Definition: xref.hpp:70
FromIterator(const Database &database, const ea_t ea)
Constructs an iterator for cross-references from a given address.
Definition: xref.hpp:78
std::pair< bool, xrefblk_t > get_first()
Retrieves the first outgoing xref.
std::pair< bool, xrefblk_t > get_next()
Retrieves the next outgoing xref.
Base class for cross-reference iterators.
Definition: xref.hpp:28
xrefblk_t m_xrefblk
Definition: xref.hpp:37
const ea_t m_ea
Definition: xref.hpp:34
Iterator(const Database &database, const ea_t ea)
Definition: xref.hpp:40
const Database & m_database
Definition: xref.hpp:31
Iterator for incoming cross-references (to the specified address).
Definition: xref.hpp:47
ToIterator(const Database &database, const ea_t ea)
Constructs an iterator for cross-references to a given address.
Definition: xref.hpp:55
std::pair< bool, xrefblk_t > get_next()
Retrieves the next incoming xref.
std::pair< bool, xrefblk_t > get_first()
Retrieves the first incoming xref.
Provides access to cross-reference (xref) analysis in the IDA database.
Definition: xref.hpp:18
Xrefs(const Database &database)
Constructs an xrefs handler for the given database.
Definition: xref.hpp:94
FromIterator get_from(const ea_t ea) const
Creates an iterator over all xrefs originating from a given address.
Definition: xref.hpp:109
ToIterator get_to(const ea_t ea) const
Creates an iterator over all xrefs pointing to a given address.
Definition: xref.hpp:101
#define IDA_API
Definition: common_defines.hpp:11
#define ABI_VERSION_NS
Definition: version.hpp:17