retdec
class.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_COMMON_CLASS_H
8 #define RETDEC_COMMON_CLASS_H
9 
10 #include <set>
11 #include <string>
12 #include <vector>
13 
14 namespace retdec {
15 namespace common {
16 
21 class Class
22 {
23  public:
24  Class(const std::string& className = std::string());
25 
28  std::string getId() const;
29  std::string getName() const;
30  std::string getDemangledName() const;
31  const std::vector<std::string>& getSuperClasses() const;
32  bool hasConstructor(const std::string& name) const;
33  bool hasDestructor(const std::string& name) const;
34  bool hasMethod(const std::string& name) const;
35  bool hasVirtualMethod(const std::string& name) const;
36  bool hasFunction(const std::string& name) const;
38 
41  void setName(const std::string& name);
42  void setDemangledName(const std::string& demangledName);
44 
47  bool addSuperClass(const std::string& superClass);
49 
50  bool operator<(const Class& o) const;
51  bool operator==(const Class& o) const;
52 
53  public:
54  std::set<std::string> superClasses;
55  std::set<std::string> virtualMethods;
56  std::set<std::string> constructors;
57  std::set<std::string> destructors;
58  std::set<std::string> methods;
59  std::set<std::string> virtualTables;
60 
61  private:
62  std::string _name;
63  std::string _demangledName;
64  std::vector<std::string> _superClasses;
65 };
66 
71 {
72  using is_transparent = void;
73 
74  bool operator()(const Class& c1, const Class& c2) const
75  {
76  return c1 < c2;
77  }
78  bool operator()(const std::string& id, Class const& c) const
79  {
80  return id < c.getName();
81  }
82  bool operator()(const Class& c, const std::string& id) const
83  {
84  return c.getName() < id;
85  }
86 };
87 using ClassContainer = std::set<Class, ClassCompare>;
88 
89 } // namespace common
90 } // namespace retdec
91 
92 #endif
Definition: class.h:22
bool hasMethod(const std::string &name) const
Definition: class.cpp:82
bool hasFunction(const std::string &name) const
Definition: class.cpp:100
bool hasVirtualMethod(const std::string &name) const
Definition: class.cpp:90
std::string getDemangledName() const
Definition: class.cpp:40
std::set< std::string > virtualTables
Definition: class.h:59
std::set< std::string > destructors
Definition: class.h:57
std::string getName() const
Definition: class.cpp:35
const std::vector< std::string > & getSuperClasses() const
Definition: class.cpp:45
std::string _name
Definition: class.h:62
bool addSuperClass(const std::string &superClass)
Definition: class.cpp:112
std::set< std::string > methods
Definition: class.h:58
std::vector< std::string > _superClasses
Definition: class.h:64
bool operator<(const Class &o) const
Definition: class.cpp:126
bool operator==(const Class &o) const
Definition: class.cpp:134
std::string getId() const
Definition: class.cpp:30
Class(const std::string &className=std::string())
Definition: class.cpp:21
void setDemangledName(const std::string &demangledName)
Definition: class.cpp:55
std::set< std::string > superClasses
Definition: class.h:54
std::set< std::string > constructors
Definition: class.h:56
bool hasDestructor(const std::string &name) const
Definition: class.cpp:71
void setName(const std::string &name)
Definition: class.cpp:50
std::set< std::string > virtualMethods
Definition: class.h:55
bool hasConstructor(const std::string &name) const
Definition: class.cpp:63
std::string _demangledName
Definition: class.h:63
std::set< Class, ClassCompare > ClassContainer
Definition: class.h:87
T & id(T &object)
Returns object.
Definition: debug.h:208
Definition: archive_wrapper.h:19
Definition: class.h:71
bool operator()(const std::string &id, Class const &c) const
Definition: class.h:78
bool operator()(const Class &c1, const Class &c2) const
Definition: class.h:74
void is_transparent
Definition: class.h:72
bool operator()(const Class &c, const std::string &id) const
Definition: class.h:82