|
TS_CPP
An efficient & easy to use implementation of a Symbol table used in most compilers
|
#include <AttributeValue.h>
Classes | |
| union | DataUnion |
| Union which stores either a numeric value (.num) or a pointer to a c string (.strPtr) More... | |
Public Types | |
| enum | AttributeType { NOATRIB = 0 , INT , STRING } |
| Enum containing the type of attribute used. More... | |
| typedef std::pair< AttributeType, DataUnion > | AttributeValuePair |
Public Member Functions | |
| AttributeValue (const char *strPtr) | |
| AttributeValue (long long integer) | |
| ~AttributeValue () | |
| bool | operator== (const AttributeValue &other) |
| bool | operator!= (const AttributeValue &other) |
| std::pair< AttributeType, DataUnion > | getValue () |
| bool | isAValidAttributeValue () |
Class returned by Entry::getAttribute with the fields:
| attributeType | An enum containing the type of the attribute (if the attribute does not exist, entryType is Null) |
| data | An union which contains either the integer stored or the pointer to the c string stored (if the attribute does not exist, data is nullptr (or 0 if viewed as int)) |
Definition at line 18 of file AttributeValue.h.
| typedef std::pair<AttributeType,DataUnion> TS_CPP::AttributeValue::AttributeValuePair |
Definition at line 27 of file AttributeValue.h.
Enum containing the type of attribute used.
Definition at line 22 of file AttributeValue.h.
|
explicit |
This constructor initializes an AttributeValue object with a c string as a value If the strPtr is null, an Atribute of type NOATRIB is returned instead
| strPtr | The pointer to the string that will be copied inside and stored as the value |
Definition at line 5 of file AttributeValue.cpp.
|
explicit |
This constructor initializes an AttributeValue object with a long long as a value
| integer | The long long number stored as the value |
| AttributeValue::~AttributeValue | ( | ) |
This destructor check if the value is a c string, and if it is, it frees the memory pointed by the stored pointer before freeing itself
Definition at line 26 of file AttributeValue.cpp.
| std::pair< AttributeValue::AttributeType, AttributeValue::DataUnion > AttributeValue::getValue | ( | ) |
This function get the value of the attribute The availability of the string pointed by DataUnion is guaranteed until object destruction
Definition at line 58 of file AttributeValue.cpp.
| bool AttributeValue::isAValidAttributeValue | ( | ) |
This function returns true if the data stored inside is valid or false if the data used is invalid (i.e: a null pointer to a string)
Definition at line 63 of file AttributeValue.cpp.
| bool AttributeValue::operator!= | ( | const AttributeValue & | other | ) |
The != operator returns true if both AttributeValues have different types or its value is different (either the c string or the integer) or false otherwise
| other | The other AttributeValue used to compare |
Definition at line 53 of file AttributeValue.cpp.
| bool AttributeValue::operator== | ( | const AttributeValue & | other | ) |
The == operator returns true if both AttributeValues have the same type and its value is the same (either the c string or the integer) or false otherwise
| other | The other AttributeValue used to compare |
Definition at line 34 of file AttributeValue.cpp.