Key / Value pair. More...
Public Member Functions | |
Entry () | |
Create an empty key value pair object. | |
Entry (const char *pKey, const char *pValue) | |
Create a key value pair object initialized with a key and a value. | |
virtual | ~Entry () |
Call the destructor for an Entry object. | |
const char * | GetKey (void) const |
Return a pointer to the contained key string. | |
void | SetKey (const char *pInput) |
Set a new key string. | |
void | SetKey (const String *pInput) |
Set a new key string. | |
const char * | GetValue (void) const |
Return a pointer to the contained value string. | |
void | SetValue (const char *pInput) |
Set a new value string. | |
void | SetValue (const String *pInput) |
Set a new value string. | |
uint_t | GetBoolean (uint_t bDefault) const |
Return a boolean value (TRUE or FALSE) | |
void | SetBoolean (uint_t bValue) |
Set a boolean value (TRUE or FALSE) | |
uint_t | GetWord (uint_t uDefault, uint_t uMin=0, uint_t uMax=0xFFFFFFFFU) const |
Return an unsigned integer value. | |
void | SetWord (uint_t uValue) |
Set an unsigned integer value. | |
void | SetWordHex (uint_t uValue) |
Set an unsigned integer value as hex. | |
int_t | GetInt (int_t iDefault, int_t iMin=(- 0x7FFFFFFF) -1, int_t iMax=0x7FFFFFFF) const |
Return a signed integer value. | |
void | SetInt (int_t iValue) |
Set a signed integer value. | |
float | GetFloat (float fDefault, float fMin, float fMax) const |
Return a floating point value. | |
void | SetFloat (float fValue) |
Set a 32 bit floating point value. | |
double | GetDouble (double dDefault, double dMin, double dMax) const |
Return a 64 bit floating point value. | |
void | SetDouble (double fValue) |
Set a 64 bit floating point value. | |
void | GetString (String *pOutput, const char *pDefault) const |
Locate and return a quoted string. | |
void | SetString (const char *pValue) |
Locate an entry and set a new quoted string. | |
Public Member Functions inherited from Burger::FileINI::Generic | |
Generic (eType uType) | |
Initialize a generic object. | |
virtual | ~Generic () |
Call the destructor for a generic object. | |
Generic * | GetNext (void) const |
Get the pointer to the next object in the list. | |
Generic * | GetPrevious (void) const |
Get the pointer to the previous object in the list. | |
eType | GetType (void) const |
Get the enumeration of the derived class' type. | |
void | InsertBefore (Generic *pGeneric) |
Insert this object before this one in the linked list. | |
void | InsertAfter (Generic *pGeneric) |
Insert this object after this one in the linked list. | |
Public Member Functions inherited from Burger::Base | |
const char * | get_class_name (void) const noexcept |
Get the name of the class. | |
virtual const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept |
Get the description to the class. | |
virtual | ~Base () noexcept=default |
Destructor. | |
Static Public Member Functions | |
static Entry * | New (void) |
Allocate an empty key value pair object. | |
static Entry * | New (const char *pKey, const char *pValue) |
Allocate a key value pair object initialized with a key and a value. | |
Private Attributes | |
String | m_Key |
Value's key. | |
String | m_Value |
UTF-8 form of the value. | |
Additional Inherited Members | |
Public Types inherited from Burger::FileINI::Generic | |
enum | eType { LINEENTRY_ROOT , LINEENTRY_SECTION , LINEENTRY_ENTRY , LINEENTRY_COMMENT } |
Enumeration to identify derived classes. More... | |
Static Public Attributes inherited from Burger::Base | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Key / Value pair.
INI files have data entries in the form of..
This class will contain the string preceding the '=' as a "Key" and the data after the '=' as the value. All values are stored as strings and the method of query will determine if it is to be treated as an integer, float or string object.
Burger::FileINI::Entry::Entry | ( | ) |
Create an empty key value pair object.
Burger::FileINI::Entry::Entry | ( | const char * | pKey, |
const char * | pValue ) |
Create a key value pair object initialized with a key and a value.
pKey | "C" string containing the new key |
pValue | "C" string containing the data attached to the key |
|
virtual |
Call the destructor for an Entry object.
Unlink itself from the linked list and release the contained strings
uint_t BURGER_API Burger::FileINI::Entry::GetBoolean | ( | uint_t | bDefault | ) | const |
Return a boolean value (TRUE or FALSE)
Scan the value string and if it matches the word TRUE or FALSE (Case insensitive), it will return TRUE or FALSE. If the value is numeric, it will return TRUE if the value is not zero and FALSE if not.
If it's none of the above, then return the default value
bDefault | Value to return on error |
double BURGER_API Burger::FileINI::Entry::GetDouble | ( | double | dDefault, |
double | dMin, | ||
double | dMax ) const |
Return a 64 bit floating point value.
Scan the value string as a 64 bit floating point numeric value and if successful, test it against the valid range and return the value clamped to that range. If it's not a number, return the default.
If NaN or Inf is detected, it will be converted to a zero to prevent floating point issues.
dDefault | Value to return on error |
dMin | Minimum acceptable value |
dMax | Maximum acceptable value |
float BURGER_API Burger::FileINI::Entry::GetFloat | ( | float | fDefault, |
float | fMin, | ||
float | fMax ) const |
Return a floating point value.
Scan the value string as a 32 bit floating point numeric value and if successful, test it against the valid range and return the value clamped to that range. If it's not a number, return the default.
If NaN or Inf is detected, it will be converted to a zero to prevent floating point issues.
fDefault | Value to return on error |
fMin | Minimum acceptable value |
fMax | Maximum acceptable value |
int_t BURGER_API Burger::FileINI::Entry::GetInt | ( | int_t | iDefault, |
int_t | iMin = (- 0x7FFFFFFF )-1, | ||
int_t | iMax = 0x7FFFFFFF ) const |
Return a signed integer value.
Scan the value string as a 32 bit signed integer or hex value and if successful, test it against the valid range and return the value clamped to that range. If it's not a number, return the default.
Hex strings are acceptable input in the form of $1234 and 0x1234. 0xFFFFFFFF will be converted to -1.
iDefault | Value to return on error |
iMin | Minimum acceptable value |
iMax | Maximum acceptable value |
|
inline |
Return a pointer to the contained key string.
void BURGER_API Burger::FileINI::Entry::GetString | ( | String * | pOutput, |
const char * | pDefault ) const |
Locate and return a quoted string.
Return the string without enclosing quotes. The string can have quotes if double quotes were used.
If it's none of the above, then return the default value
pOutput | Pointer to a String class to hold the resulting string |
pDefault | String to return on error |
|
inline |
Return a pointer to the contained value string.
uint_t BURGER_API Burger::FileINI::Entry::GetWord | ( | uint_t | uDefault, |
uint_t | uMin = 0, | ||
uint_t | uMax = 0xFFFFFFFFU ) const |
Return an unsigned integer value.
Scan the value string as a 32 bit unsigned integer or hex value and if successful, test it against the valid range and return the value clamped to that range. If it's not a number, return the default.
Hex strings are acceptable input in the form of $1234 and 0x1234
uDefault | Value to return on error |
uMin | Minimum acceptable value |
uMax | Maximum acceptable value |
|
static |
Allocate a key value pair object initialized with a key and a value.
pKey | "C" string containing the new key |
pValue | "C" string containing the data attached to the key |
|
static |
Allocate an empty key value pair object.
void BURGER_API Burger::FileINI::Entry::SetBoolean | ( | uint_t | bValue | ) |
Set a boolean value (TRUE or FALSE)
If the input value is zero, set the string to "FALSE", otherwise set the string to "TRUE". It will not store numeric values.
bValue | Value to store as a string |
void BURGER_API Burger::FileINI::Entry::SetDouble | ( | double | dValue | ) |
Set a 64 bit floating point value.
Convert the input into an floating point representation of a UTF-8 string and set the value to this string
dValue | Value to store as a 64 bit floating point string |
void BURGER_API Burger::FileINI::Entry::SetFloat | ( | float | fValue | ) |
Set a 32 bit floating point value.
Convert the input into an floating point representation of a UTF-8 string and set the value to this string
fValue | Value to store as a floating point string |
void BURGER_API Burger::FileINI::Entry::SetInt | ( | int_t | iValue | ) |
Set a signed integer value.
Convert the input into an signed integer UTF-8 string and set the value to this string
iValue | Value to store as a signed integer string |
|
inline |
Set a new key string.
Replace the contained key string with a new one
pInput | Pointer to a "C" string |
|
inline |
Set a new key string.
Replace the contained key string with a new one
pInput | Pointer to a String class instance |
void BURGER_API Burger::FileINI::Entry::SetString | ( | const char * | pValue | ) |
|
inline |
Set a new value string.
Replace the contained value string with a new one
pInput | Pointer to a "C" string |
|
inline |
Set a new value string.
Replace the contained value string with a new one
pInput | Pointer to a String class instance |
void BURGER_API Burger::FileINI::Entry::SetWord | ( | uint_t | uValue | ) |
Set an unsigned integer value.
Convert the input into an unsigned integer UTF-8 string and set the value to this string
uValue | Value to store as an unsigned integer string |
void BURGER_API Burger::FileINI::Entry::SetWordHex | ( | uint_t | uValue | ) |
Set an unsigned integer value as hex.
Convert the input into a "C" style hex string in the format of 0x12345678 and store this string as the value
uValue | Value to store as an unsigned integer hex string |
|
private |
Value's key.
|
private |
UTF-8 form of the value.