Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Burger::FileINI::Entry Class Reference

Key / Value pair. More...

Inheritance diagram for Burger::FileINI::Entry:
Inheritance graph
[legend]
Collaboration diagram for Burger::FileINI::Entry:
Collaboration graph
[legend]

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.
 
GenericGetNext (void) const
 Get the pointer to the next object in the list.
 
GenericGetPrevious (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::StaticRTTIget_StaticRTTI (void) const noexcept
 Get the description to the class.
 
virtual ~Base () noexcept=default
 Destructor.
 

Static Public Member Functions

static EntryNew (void)
 Allocate an empty key value pair object.
 
static EntryNew (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.
 

Detailed Description

Key / Value pair.


INI files have data entries in the form of..

Data = 1
String = "Hello world"
Number = 7.3232
UTF 8 bit string class.
Definition burger.h:14832

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.

Note
This will identify with eType of LINEENTRY_ENTRY
See also
Burger::FileINI, Burger::FileINI::Comment, Burger::FileINI::Generic or Burger::FileINI::Section

Constructor & Destructor Documentation

◆ Entry() [1/2]

Burger::FileINI::Entry::Entry ( )

Create an empty key value pair object.


◆ Entry() [2/2]

Burger::FileINI::Entry::Entry ( const char * pKey,
const char * pValue )

Create a key value pair object initialized with a key and a value.


Parameters
pKey"C" string containing the new key
pValue"C" string containing the data attached to the key

◆ ~Entry()

Burger::FileINI::Entry::~Entry ( )
virtual

Call the destructor for an Entry object.


Unlink itself from the linked list and release the contained strings

Member Function Documentation

◆ GetBoolean()

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

Parameters
bDefaultValue to return on error
Returns
TRUE or FALSE or bDefault
See also
SetBoolean(uint_t) or AsciiToBoolean(const char *,uint_t)

◆ GetDouble()

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.

Parameters
dDefaultValue to return on error
dMinMinimum acceptable value
dMaxMaximum acceptable value
Returns
Value in between dMin and dMax or dDefault
See also
GetFloat(float,float,float) const, SetDouble(double) or AsciiToDouble(const char *,double,double,double)

◆ GetFloat()

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.

Parameters
fDefaultValue to return on error
fMinMinimum acceptable value
fMaxMaximum acceptable value
Returns
Value in between fMin and fMax or fDefault
See also
GetDouble(double,double,double) const, SetFloat(float) or AsciiToFloat(const char *,float,float,float)

◆ GetInt()

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.

Parameters
iDefaultValue to return on error
iMinMinimum acceptable value
iMaxMaximum acceptable value
Returns
Value in between iMin and iMax or iDefault
See also
GetWord(uint_t,uint_t,uint_t) const, SetInt(int_t) or AsciiToInteger(const char *,int_t,int_t,int_t)

◆ GetKey()

const char * Burger::FileINI::Entry::GetKey ( void ) const
inline

Return a pointer to the contained key string.


See also
GetValue(void) const, SetKey(const char *) or SetKey(const String *)

◆ GetString()

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

Parameters
pOutputPointer to a String class to hold the resulting string
pDefaultString to return on error
See also
SetString(const char *,const char *)

◆ GetValue()

const char * Burger::FileINI::Entry::GetValue ( void ) const
inline

Return a pointer to the contained value string.


See also
GetKey(void) const, SetValue(const char *) or SetValue(const String *)

◆ GetWord()

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

Parameters
uDefaultValue to return on error
uMinMinimum acceptable value
uMaxMaximum acceptable value
Returns
Value in between uMin and uMax or uDefault
See also
GetInt(int_t,int_t,int_t) const, SetWord(uint_t), SetWordHex(uint_t), or AsciiToWord(const char *,uint_t,uint_t,uint_t)

◆ New() [1/2]

Burger::FileINI::Entry *BURGER_API Burger::FileINI::Entry::New ( const char * pKey,
const char * pValue )
static

Allocate a key value pair object initialized with a key and a value.


Parameters
pKey"C" string containing the new key
pValue"C" string containing the data attached to the key

◆ New() [2/2]

Burger::FileINI::Entry *BURGER_API Burger::FileINI::Entry::New ( void )
static

Allocate an empty key value pair object.


◆ SetBoolean()

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.

Parameters
bValueValue to store as a string
See also
GetBoolean(uint_t) const

◆ SetDouble()

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

Parameters
dValueValue to store as a 64 bit floating point string
See also
GetDouble(double,double,double) const or SetFloat(float)

◆ SetFloat()

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

Parameters
fValueValue to store as a floating point string
See also
GetFloat(float,float,float) const or SetDouble(double)

◆ SetInt()

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

Parameters
iValueValue to store as a signed integer string
See also
GetInt(int_t,int_t,int_t) const or SetWord(uint_t)

◆ SetKey() [1/2]

void Burger::FileINI::Entry::SetKey ( const char * pInput)
inline

Set a new key string.


Replace the contained key string with a new one

Parameters
pInputPointer to a "C" string
See also
SetValue(const char *), GetKey(void) const or SetKey(const String *)

◆ SetKey() [2/2]

void Burger::FileINI::Entry::SetKey ( const String * pInput)
inline

Set a new key string.


Replace the contained key string with a new one

Parameters
pInputPointer to a String class instance
See also
SetValue(const String *), GetKey(void) const or SetKey(const char *)

◆ SetString()

void BURGER_API Burger::FileINI::Entry::SetString ( const char * pValue)

Locate an entry and set a new quoted string.


Search the entries in the Section and if found convert the input into an quoted string.

If not found, create the entry with the data.

Parameters
pValueString to encapsulate with quotes
See also
GetString(String *,const char *,const char *) const

◆ SetValue() [1/2]

void Burger::FileINI::Entry::SetValue ( const char * pInput)
inline

Set a new value string.


Replace the contained value string with a new one

Parameters
pInputPointer to a "C" string
See also
SetKey(const char *), GetValue(void) const or SetValue(const String *)

◆ SetValue() [2/2]

void Burger::FileINI::Entry::SetValue ( const String * pInput)
inline

Set a new value string.


Replace the contained value string with a new one

Parameters
pInputPointer to a String class instance
See also
SetKey(const String *), GetValue(void) const or SetValue(const char *)

◆ SetWord()

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

Parameters
uValueValue to store as an unsigned integer string
See also
GetWord(uint_t,uint_t,uint_t) const or SetWordHex(uint_t)

◆ SetWordHex()

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

Parameters
uValueValue to store as an unsigned integer hex string
See also
GetWord(uint_t,uint_t,uint_t) const or SetWord(uint_t)

Member Data Documentation

◆ m_Key

String Burger::FileINI::Entry::m_Key
private

Value's key.

◆ m_Value

String Burger::FileINI::Entry::m_Value
private

UTF-8 form of the value.