retdec
Private Types | Private Attributes | List of all members
retdec::fileformat::SymbolTable Class Reference

#include <symbol_table.h>

Collaboration diagram for retdec::fileformat::SymbolTable:
Collaboration graph
[legend]

Public Member Functions

Const getters
std::size_t getNumberOfSymbols () const
 
const SymbolgetSymbol (std::size_t symbolIndex) const
 
const SymbolgetSymbol (const std::string &name) const
 
const SymbolgetSymbolOnAddress (unsigned long long addr) const
 
const SymbolgetSymbolWithIndex (std::size_t symbolIndex) const
 
const std::string & getName () const
 
Getters
SymbolgetSymbol (std::size_t symbolIndex)
 
SymbolgetSymbol (const std::string &name)
 
SymbolgetSymbolOnAddress (unsigned long long addr)
 
SymbolgetSymbolWithIndex (std::size_t symbolIndex)
 
Iterators
symbolsConstIterator begin () const
 
symbolsIterator begin ()
 
symbolsConstIterator end () const
 
symbolsIterator end ()
 
Other methods
void clear ()
 
void addSymbol (const std::shared_ptr< Symbol > &symbol)
 
void addSymbol (std::shared_ptr< Symbol > &&symbol)
 
bool hasSymbols () const
 
bool hasSymbol (const std::string &name) const
 
bool hasSymbol (unsigned long long addr) const
 
void dump (std::string &dumpTable) const
 
void setName (const std::string &symbolTableName)
 

Private Types

using symbolsConstIterator = std::vector< std::shared_ptr< Symbol > >::const_iterator
 
using symbolsIterator = std::vector< std::shared_ptr< Symbol > >::iterator
 

Private Attributes

std::vector< std::shared_ptr< Symbol > > table
 stored symbols More...
 
std::string name
 name of symbol table More...
 

Detailed Description

Class for symbol table

Member Typedef Documentation

◆ symbolsConstIterator

using retdec::fileformat::SymbolTable::symbolsConstIterator = std::vector<std::shared_ptr<Symbol> >::const_iterator
private

◆ symbolsIterator

using retdec::fileformat::SymbolTable::symbolsIterator = std::vector<std::shared_ptr<Symbol> >::iterator
private

Member Function Documentation

◆ addSymbol() [1/2]

void retdec::fileformat::SymbolTable::addSymbol ( const std::shared_ptr< Symbol > &  symbol)

Add new symbol to table

Parameters
symbolNew symbol

◆ addSymbol() [2/2]

void retdec::fileformat::SymbolTable::addSymbol ( std::shared_ptr< Symbol > &&  symbol)

Add new symbol to table

Parameters
symbolNew symbol

◆ begin() [1/2]

SymbolTable::symbolsIterator retdec::fileformat::SymbolTable::begin ( )

Get begin iterator

Returns
Begin iterator

◆ begin() [2/2]

SymbolTable::symbolsConstIterator retdec::fileformat::SymbolTable::begin ( ) const

Get begin constant iterator

Returns
Begin constant iterator

◆ clear()

void retdec::fileformat::SymbolTable::clear ( )

Delete all records from table

◆ dump()

void retdec::fileformat::SymbolTable::dump ( std::string &  dumpTable) const

Dump information about all symbols in table

Parameters
dumpTableInto this parameter is stored dump of symbol table in an LLVM style

◆ end() [1/2]

SymbolTable::symbolsIterator retdec::fileformat::SymbolTable::end ( )

Get end iterator

Returns
End iterator

◆ end() [2/2]

SymbolTable::symbolsConstIterator retdec::fileformat::SymbolTable::end ( ) const

Get end constant iterator

Returns
End constant iterator

◆ getName()

const std::string & retdec::fileformat::SymbolTable::getName ( ) const

Get name of the symbol table.

Returns
Name of the symbol table.

◆ getNumberOfSymbols()

std::size_t retdec::fileformat::SymbolTable::getNumberOfSymbols ( ) const

Get number of symbols in table

Returns
Number of symbols in table

◆ getSymbol() [1/4]

Symbol * retdec::fileformat::SymbolTable::getSymbol ( const std::string &  name)

Get symbol by name

Parameters
nameName of the symbol to get
Returns
Pointer to symbol with the specified name or nullptr if such item not found

◆ getSymbol() [2/4]

const Symbol * retdec::fileformat::SymbolTable::getSymbol ( const std::string &  name) const

Get symbol by name

Parameters
nameName of the symbol to get
Returns
Pointer to symbol with the specified name or nullptr if such item not found

◆ getSymbol() [3/4]

Symbol * retdec::fileformat::SymbolTable::getSymbol ( std::size_t  symbolIndex)

Get pointer to symbol from table

Parameters
symbolIndexIndex of selected symbol (indexed from 0)
Returns
Pointer to symbol or nullptr if symbol index is invalid

◆ getSymbol() [4/4]

const Symbol * retdec::fileformat::SymbolTable::getSymbol ( std::size_t  symbolIndex) const

Get pointer to symbol from table

Parameters
symbolIndexIndex of selected symbol (indexed from 0)
Returns
Pointer to symbol or nullptr if symbol index is invalid

◆ getSymbolOnAddress() [1/2]

Symbol * retdec::fileformat::SymbolTable::getSymbolOnAddress ( unsigned long long  addr)

Get pointer to symbol from table

Parameters
addrAddress of selected symbol
Returns
Pointer to symbol or nullptr if symbol address is invalid

◆ getSymbolOnAddress() [2/2]

const Symbol * retdec::fileformat::SymbolTable::getSymbolOnAddress ( unsigned long long  addr) const

Get pointer to symbol from table

Parameters
addrAddress of selected symbol
Returns
Pointer to symbol or nullptr if symbol address is invalid

◆ getSymbolWithIndex() [1/2]

Symbol * retdec::fileformat::SymbolTable::getSymbolWithIndex ( std::size_t  symbolIndex)

Get pointer to symbol from table with specified index

Parameters
symbolIndexIndex stored in symbol
Returns
Pointer to symbol or nullptr if symbol with index is not found

◆ getSymbolWithIndex() [2/2]

const Symbol * retdec::fileformat::SymbolTable::getSymbolWithIndex ( std::size_t  symbolIndex) const

Get pointer to symbol from table with specified index

Parameters
symbolIndexIndex stored in symbol
Returns
Pointer to symbol or nullptr if symbol with index is not found

◆ hasSymbol() [1/2]

bool retdec::fileformat::SymbolTable::hasSymbol ( const std::string &  name) const

Check if symbol with name name exists

Parameters
nameName of symbol
Returns
true if has symbol with name name, false otherwise

◆ hasSymbol() [2/2]

bool retdec::fileformat::SymbolTable::hasSymbol ( unsigned long long  addr) const

Check if symbol on address exists

Parameters
addrAdress of symbol
Returns
true if has symbol on address, false otherwise

◆ hasSymbols()

bool retdec::fileformat::SymbolTable::hasSymbols ( ) const

Find out if there are any symbols.

Returns
true if there are some symbols, false otherwise

◆ setName()

void retdec::fileformat::SymbolTable::setName ( const std::string &  symbolTableName)

Sets the name of the symbol table.

Parameters
symbolTableNameName of the symbol table.

Member Data Documentation

◆ name

std::string retdec::fileformat::SymbolTable::name
private

name of symbol table

◆ table

std::vector<std::shared_ptr<Symbol> > retdec::fileformat::SymbolTable::table
private

stored symbols


The documentation for this class was generated from the following files: