|
TS_CPP
An efficient & easy to use implementation of a Symbol table used in most compilers
|
#include <Entry.h>
Public Member Functions | |
| Entry (SymbolTable *parentTable, const std::string &lexeme, int id) | |
| std::string | getLexeme () const |
| int | getId () const |
| AttributeValue * | getAttribute (const std::string &attributeName) |
| long long | getDisplacement () |
| void | setNumericAttribute (const std::string &attributeName, long long value) |
| void | setSize (int size) |
| void | _setDisplacement (int displacement) |
| void | _markAsDeleted () |
| bool | _isDeleted () const |
| void | setStringAttribute (const std::string &attributeName, const char *value) |
| bool | deleteAttribute (const std::string &attributeName) |
| bool | getHaveSize () const |
| std::unordered_map< std::string, AttributeValue * > & | _getAttributesStorage () |
Entry class provides support for each row inside the symbol table It consists of a lexeme, an id and an undefined amount of pairs consisting of attribute name and value (int/string)
| Entry::Entry | ( | SymbolTable * | parentTable, |
| const std::string & | lexeme, | ||
| int | id ) |
The constructor of an Entry It should not be used directly, but using the method SymbolTable::createNewEntry
| parentTable | The parent table of this entry |
| lexeme | The lexeme of this entry |
| id | The unique identifier of the entry |
| std::unordered_map< std::string, AttributeValue * > & Entry::_getAttributesStorage | ( | ) |
| bool Entry::_isDeleted | ( | ) | const |
| void Entry::_markAsDeleted | ( | ) |
| void Entry::_setDisplacement | ( | int | displacement | ) |
| bool Entry::deleteAttribute | ( | const std::string & | attributeName | ) |
| AttributeValue * Entry::getAttribute | ( | const std::string & | attributeName | ) |
This function search for the attribute with the specified name and returns its value If the attribute does not exist, it returns a special attribute with attributeType=Null and data.str = nullptr (or data.num = 0)
| attributeName | The name of the attribute to search for |
| long long Entry::getDisplacement | ( | ) |
| bool Entry::getHaveSize | ( | ) | const |
| int Entry::getId | ( | ) | const |
| std::string Entry::getLexeme | ( | ) | const |
| void Entry::setNumericAttribute | ( | const std::string & | attributeName, |
| long long | value ) |
| void Entry::setSize | ( | int | size | ) |
| void Entry::setStringAttribute | ( | const std::string & | attributeName, |
| const char * | value ) |