retdec
symbol_table.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_FILEFORMAT_TYPES_SYMBOL_TABLE_SYMBOL_TABLE_H
8 #define RETDEC_FILEFORMAT_TYPES_SYMBOL_TABLE_SYMBOL_TABLE_H
9 
10 #include <memory>
11 #include <vector>
12 
14 
15 namespace retdec {
16 namespace fileformat {
17 
22 {
23  private:
24  using symbolsConstIterator = std::vector<std::shared_ptr<Symbol>>::const_iterator;
25  using symbolsIterator = std::vector<std::shared_ptr<Symbol>>::iterator;
26  std::vector<std::shared_ptr<Symbol>> table;
27  std::string name;
28  public:
31  std::size_t getNumberOfSymbols() const;
32  const Symbol* getSymbol(std::size_t symbolIndex) const;
33  const Symbol* getSymbol(const std::string &name) const;
34  const Symbol* getSymbolOnAddress(unsigned long long addr) const;
35  const Symbol* getSymbolWithIndex(std::size_t symbolIndex) const;
36  const std::string& getName() const;
38 
41  Symbol* getSymbol(std::size_t symbolIndex);
42  Symbol* getSymbol(const std::string &name);
43  Symbol* getSymbolOnAddress(unsigned long long addr);
44  Symbol* getSymbolWithIndex(std::size_t symbolIndex);
46 
51  symbolsConstIterator end() const;
54 
57  void clear();
58  void addSymbol(const std::shared_ptr<Symbol> &symbol);
59  void addSymbol(std::shared_ptr<Symbol> &&symbol);
60  bool hasSymbols() const;
61  bool hasSymbol(const std::string &name) const;
62  bool hasSymbol(unsigned long long addr) const;
63  void dump(std::string &dumpTable) const;
64  void setName(const std::string& symbolTableName);
66 };
67 
68 } // namespace fileformat
69 } // namespace retdec
70 
71 #endif
Definition: symbol_table.h:22
void dump(std::string &dumpTable) const
Definition: symbol_table.cpp:258
void addSymbol(const std::shared_ptr< Symbol > &symbol)
Definition: symbol_table.cpp:211
bool hasSymbols() const
Definition: symbol_table.cpp:229
void clear()
Definition: symbol_table.cpp:202
std::string name
name of symbol table
Definition: symbol_table.h:27
std::vector< std::shared_ptr< Symbol > > table
stored symbols
Definition: symbol_table.h:26
std::vector< std::shared_ptr< Symbol > >::const_iterator symbolsConstIterator
Definition: symbol_table.h:24
const Symbol * getSymbol(std::size_t symbolIndex) const
Definition: symbol_table.cpp:29
const Symbol * getSymbolOnAddress(unsigned long long addr) const
Definition: symbol_table.cpp:57
std::size_t getNumberOfSymbols() const
Definition: symbol_table.cpp:19
bool hasSymbol(const std::string &name) const
Definition: symbol_table.cpp:239
const Symbol * getSymbolWithIndex(std::size_t symbolIndex) const
Definition: symbol_table.cpp:76
const std::string & getName() const
Definition: symbol_table.cpp:93
std::vector< std::shared_ptr< Symbol > >::iterator symbolsIterator
Definition: symbol_table.h:25
symbolsConstIterator end() const
Definition: symbol_table.cpp:185
symbolsConstIterator begin() const
Definition: symbol_table.cpp:167
void setName(const std::string &symbolTableName)
Definition: symbol_table.cpp:326
Definition: symbol.h:19
Class for one symbol.
Definition: archive_wrapper.h:19