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::FileXML::Element Class Reference

XML Element object. More...

Inheritance diagram for Burger::FileXML::Element:
Inheritance graph
[legend]
Collaboration diagram for Burger::FileXML::Element:
Collaboration graph
[legend]

Public Member Functions

 Element ()
 Create an empty element object.
 
 Element (const char *pName)
 Create an empty element object.
 
virtual ~Element ()
 Call the destructor for a Element object.
 
virtual uint_t Parse (InputMemoryStream *pInput)
 Parse an XML Element object.
 
virtual uint_t Save (OutputMemoryStream *pOutput, uint_t uDepth) const
 Write out an XML Element object.
 
RootGetRoot (void)
 Return the root object.
 
const RootGetRoot (void) const
 Return the const root object.
 
const ElementFindElement (const char *pElementName) const
 Find a named XML Element.
 
ElementFindElement (const char *pElementName, uint_t bAlwaysCreate=0)
 Find a named XML Element.
 
ElementAddElement (const char *pElementName)
 Add a new Element record.
 
void DeleteElement (const char *pElementName)
 Delete an Element record.
 
void DeleteElements (const char *pElementName)
 Delete all Element records with this name.
 
AttributeFindAttribute (const char *pAttributeName, uint_t bAlwaysCreate=0)
 Traverse the linked list and find a specific named Attribute.
 
AttributeAddAttribute (const char *pAttributeName, const char *pValue=0)
 Add a new Attribute record.
 
void DeleteAttribute (const char *pAttributeName)
 Delete an Attribute record.
 
const charGetName (void) const
 Return a pointer to the element's name.
 
void SetName (const char *pInput)
 Set the name of the element.
 
void SetName (const String *pInput)
 Set the name of the element.
 
uint_t GetBoolean (uint_t bDefault) const
 Return a boolean value from the Element's RawText (TRUE or FALSE)
 
void SetBoolean (uint_t bValue)
 Set the RawText in the Element to a boolean value.
 
uint_t GetWord (uint_t uDefault, uint_t uMin=0, uint_t uMax=0xFFFFFFFFU) const
 Return an unsigned integer value from the Element's RawText.
 
void SetWord (uint_t uValue)
 Set an unsigned integer value to the Element's RawText.
 
void SetWordHex (uint_t uValue)
 Set an unsigned integer value as hex to the Element's RawText.
 
int_t GetInt (int_t iDefault, int_t iMin=(- 0x7FFFFFFF) -1, int_t iMax=0x7FFFFFFF) const
 Return a signed integer value from the Element's RawText.
 
void SetInt (int_t iValue)
 Set a signed integer value to the Element's RawText.
 
float GetFloat (float fDefault) const
 Return a floating point value from the Element's RawText.
 
float GetFloat (float fDefault, float fMin, float fMax) const
 Return a floating point value from the Element's RawText.
 
void SetFloat (float fValue)
 Set a 32 bit floating point value to the Element's RawText.
 
double GetDouble (double dDefault) const
 Return a 64 bit floating point value from the Element's RawText.
 
double GetDouble (double dDefault, double dMin, double dMax) const
 Return a 64 bit floating point value from the Element's RawText.
 
void SetDouble (double dValue)
 Set a 64 bit floating point value to the Element's RawText.
 
const charGetString (const char *pDefault) const
 Locate and return the Element's RawText.
 
void SetString (const char *pValue)
 Set the Element's RawText object.
 
uint_t AttributeGetBoolean (const char *pAttributeName, uint_t bDefault) const
 Return a boolean value from an Attribute (TRUE or FALSE)
 
void AttributeSetBoolean (const char *pAttributeName, uint_t bValue)
 Set an Attribute to a boolean value.
 
uint_t AttributeGetWord (const char *pAttributeName, uint_t uDefault, uint_t uMin=0, uint_t uMax=0xFFFFFFFFU) const
 Return an unsigned integer value from an Attribute.
 
void AttributeSetWord (const char *pAttributeName, uint_t uValue)
 Set an unsigned integer value to the Element's Attribute's value.
 
void AttributeSetWordHex (const char *pAttributeName, uint_t uValue)
 Set an unsigned integer value as hex to the Element's Attribute's value.
 
int_t AttributeGetInt (const char *pAttributeName, int_t iDefault, int_t iMin=(- 0x7FFFFFFF) - 1, int_t iMax=0x7FFFFFFF) const
 Return a signed integer value from an Attribute.
 
void AttributeSetInt (const char *pAttributeName, int_t iValue)
 Set a signed integer value to the Element's Attribute's value.
 
float AttributeGetFloat (const char *pAttributeName, float fDefault) const
 Return a floating point value from an Attribute.
 
float AttributeGetFloat (const char *pAttributeName, float fDefault, float fMin, float fMax) const
 Return a floating point value from an Attribute.
 
void AttributeSetFloat (const char *pAttributeName, float fValue)
 Set a 32 bit floating point value to the Element's Attribute's value.
 
double AttributeGetDouble (const char *pAttributeName, double dDefault) const
 Return a 64 bit floating point value from an Attribute.
 
double AttributeGetDouble (const char *pAttributeName, double dDefault, double dMin, double dMax) const
 Return a 64 bit floating point value from an Attribute.
 
void AttributeSetDouble (const char *pAttributeName, double dValue)
 Set a 64 bit floating point value to the Element's Attribute's value.
 
const charAttributeGetString (const char *pAttributeName, const char *pDefault) const
 Locate and return the Element's Attribute value text.
 
void AttributeSetString (const char *pAttributeName, const char *pValue)
 Set the Element's Attribute object's value.
 
uint_t ElementGetBoolean (const char *pElementName, uint_t bDefault) const
 Return a boolean value from an Element's RawText (TRUE or FALSE)
 
void ElementSetBoolean (const char *pElementName, uint_t bValue)
 Set an Element's RawText to a boolean value.
 
uint_t ElementGetWord (const char *pElementName, uint_t uDefault, uint_t uMin=0, uint_t uMax=0xFFFFFFFFU) const
 Return an unsigned integer value from an Element's RawText.
 
void ElementSetWord (const char *pElementName, uint_t uValue)
 Set an unsigned integer value into a named Element's RawText.
 
void ElementSetWordHex (const char *pElementName, uint_t uValue)
 Set an unsigned integer value as hex into a named Element's RawText.
 
int_t ElementGetInt (const char *pElementName, int_t iDefault, int_t iMin=(- 0x7FFFFFFF) -1, int_t iMax=0x7FFFFFFF) const
 Return a signed integer value from an Element's RawText.
 
void ElementSetInt (const char *pElementName, int_t iValue)
 Set a signed integer value into a named Element's RawText.
 
float ElementGetFloat (const char *pElementName, float fDefault) const
 Return a floating point value from an Element's RawText.
 
float ElementGetFloat (const char *pElementName, float fDefault, float fMin, float fMax) const
 Return a floating point value from an Element's RawText.
 
void ElementSetFloat (const char *pElementName, float fValue)
 Set a 32 bit floating point value into a named Element's RawText.
 
double ElementGetDouble (const char *pElementName, double dDefault) const
 Return a 64 bit floating point value from an Element's RawText.
 
double ElementGetDouble (const char *pElementName, double dDefault, double dMin, double dMax) const
 Return a 64 bit floating point value from an Element's RawText.
 
void ElementSetDouble (const char *pElementName, double dValue)
 Set a 64 bit floating point value into a named Element's RawText.
 
const charElementGetString (const char *pElementName, const char *pDefault) const
 Locate and return the named Element's RawText text.
 
void ElementSetString (const char *pElementName, const char *pValue)
 Set the the named Element's RawText string.
 
- Public Member Functions inherited from Burger::FileXML::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.
 
ElementGetNextElement (void) const
 Follow the linked list of items to the next Element.
 
ElementGetNextElement (const char *pElementName) const
 Follow the linked list of items to the next named Element.
 
GenericGetNextItem (void) const
 Follow the linked list of items to the next object.
 
- Public Member Functions inherited from Burger::Base
const charget_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 ElementNew (InputMemoryStream *pInput)
 Create a new Element structure and initialize it from an input file.
 
static ElementNew (const char *pName)
 Create a new Element structure and initialize its name.
 

Private Attributes

Root m_Attributes
 Linked list root for all attached attributes.
 
Root m_Root
 Linked list root for all contained objects.
 
String m_Name
 Name of the element.
 

Additional Inherited Members

- Public Types inherited from Burger::FileXML::Generic
enum  eType {
  XML_ROOT , XML_COMMENT , XML_CDATA , XML_ATTRIBUTE ,
  XML_DECLARATION , XML_DOCUMENT , XML_ELEMENT , XML_TEXT ,
  XML_UNKNOWN
}
 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

XML Element object.


XML files mostly are populated by XML elements that are declared with either a <foobar /> or a <foobar></foobar> string. These objects can contain other objects.

Note
This will identify with eType of XML_ELEMENT
See also
FileXML, FileXML::Generic, FileXML::Comment or FileXML::Declaration

Constructor & Destructor Documentation

◆ Element() [1/2]

Burger::FileXML::Element::Element ( )

Create an empty element object.


◆ Element() [2/2]

Burger::FileXML::Element::Element ( const char * pName)

Create an empty element object.


Parameters
pNamePointer to a "C" string for the element's name

◆ ~Element()

Burger::FileXML::Element::~Element ( )
virtual

Call the destructor for a Element object.


Unlink itself from the linked list and release the contained strings

Member Function Documentation

◆ AddAttribute()

BURGER_INLINE Attribute * Burger::FileXML::Element::AddAttribute ( const char * pAttributeName,
const char * pValue = 0 )
inline

Add a new Attribute record.


Create a new Attribute and place it as the last record in the Element's Attribute list.

Note
If the Attribute already exists, the contents will be updated with the new pValue.
Parameters
pAttributeNamePointer to a "C" string to the Attribute to search for.
pValuePointer to a "C" string for the data field for the Attribute. NULL yields an empty string.
Returns
Pointer to an XML Element or NULL if out of memory
See also
FindAttribute(const char *,uint_t) or DeleteAttribute()

◆ AddElement()

BURGER_INLINE Element * Burger::FileXML::Element::AddElement ( const char * pElementName)
inline

Add a new Element record.


Create a new Element and place it as the last record in the Element's list.

Note
XML allows multiple Elements with the same name. This function will not check if any preexisting Element records possess the same name.
Parameters
pElementNamePointer to a "C" string to the element to search for.
Returns
Pointer to an XML Element or NULL if out of memory
See also
FindElement(const char *,uint_t) or DeleteElement()

◆ AttributeGetBoolean()

uint_t BURGER_API Burger::FileXML::Element::AttributeGetBoolean ( const char * pAttributeName,
uint_t bDefault ) const

Return a boolean value from an Attribute (TRUE or FALSE)


Find the Attribute with the supplied Attribute name that's stored in the Element and parse it as a Boolean with "true", "yes" or non zero returning TRUE and "false", "no" or 0 returning FALSE.

If it's none of the above, then return the default value

Parameters
pAttributeName"C" string for the name of the Attribute to parse
bDefaultValue to return on error
Returns
TRUE or FALSE or bDefault
See also
AttributeSetBoolean(const char *,uint_t) or AsciiToBoolean(const char *,uint_t)

◆ AttributeGetDouble() [1/2]

double BURGER_API Burger::FileXML::Element::AttributeGetDouble ( const char * pAttributeName,
double dDefault ) const

Return a 64 bit floating point value from an Attribute.


Find the Attribute with the supplied Attribute name that's stored in the Element and parse it as a 64 bit floating point numeric value and if successful, return it. 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
pAttributeNamePointer to a "C" string with the name of the Attribute
dDefaultValue to return on error
Returns
Value or dDefault
See also
AttributeGetFloat(const char *,float) const, AttributeSetDouble(const char *,double) or AsciiToDouble(const char *,double)

◆ AttributeGetDouble() [2/2]

double BURGER_API Burger::FileXML::Element::AttributeGetDouble ( const char * pAttributeName,
double dDefault,
double dMin,
double dMax ) const

Return a 64 bit floating point value from an Attribute.


Find the Attribute with the supplied Attribute name that's stored in the Element and parse it 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
pAttributeNamePointer to a "C" string with the name of the Attribute
dDefaultValue to return on error
dMinMinimum acceptable value
dMaxMaximum acceptable value
Returns
Value in between dMin and dMax or dDefault
See also
AttributeGetFloat(const char *,float,float,float) const, AttributeSetDouble(const char *,double) or AsciiToDouble(const char *,double,double,double)

◆ AttributeGetFloat() [1/2]

float BURGER_API Burger::FileXML::Element::AttributeGetFloat ( const char * pAttributeName,
float fDefault ) const

Return a floating point value from an Attribute.


Find the Attribute with the supplied Attribute name that's stored in the Element and parse it as a 32 bit floating point numeric value and if successful, return it. 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
pAttributeNamePointer to a "C" string with the name of the Attribute
fDefaultValue to return on error
Returns
Value or fDefault
See also
AttributeGetDouble(const char *,double) const, AttributeSetFloat(const char *,float) or AsciiToFloat(const char *,float)

◆ AttributeGetFloat() [2/2]

float BURGER_API Burger::FileXML::Element::AttributeGetFloat ( const char * pAttributeName,
float fDefault,
float fMin,
float fMax ) const

Return a floating point value from an Attribute.


Find the Attribute with the supplied Attribute name that's stored in the Element and parse it 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
pAttributeNamePointer to a "C" string with the name of the Attribute
fDefaultValue to return on error
fMinMinimum acceptable value
fMaxMaximum acceptable value
Returns
Value in between fMin and fMax or fDefault
See also
AttributeGetDouble(const char *,double,double,double) const, AttributeSetFloat(const char *,float) or AsciiToFloat(const char *,float,float,float)

◆ AttributeGetInt()

int_t BURGER_API Burger::FileXML::Element::AttributeGetInt ( const char * pAttributeName,
int_t iDefault,
int_t iMin = (- 0x7FFFFFFF ) - 1,
int_t iMax = 0x7FFFFFFF ) const

Return a signed integer value from an Attribute.


Find the Attribute with the supplied Attribute name that's stored in the Element and parse it 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
pAttributeNamePointer to a "C" string with the name of the Attribute
iDefaultValue to return on error
iMinMinimum acceptable value
iMaxMaximum acceptable value
Returns
Value in between iMin and iMax or iDefault
See also
AttributeGetWord(const char *,uint_t,uint_t,uint_t) const, AttributeSetInt(const char *,int_t) or AsciiToInteger(const char *,int_t,int_t,int_t)

◆ AttributeGetString()

const char *BURGER_API Burger::FileXML::Element::AttributeGetString ( const char * pAttributeName,
const char * pDefault ) const

Locate and return the Element's Attribute value text.


Return the pointer to the value of Element's Attribute object.

If it's not present, then return the default value

Parameters
pAttributeNamePointer to a "C" string with the name of the Attribute
pDefaultString to return on error
Returns
Pointer to the RawText string or pDefault
See also
AttributeSetString(const char *,const char *)

◆ AttributeGetWord()

uint_t BURGER_API Burger::FileXML::Element::AttributeGetWord ( const char * pAttributeName,
uint_t uDefault,
uint_t uMin = 0,
uint_t uMax = 0xFFFFFFFFU ) const

Return an unsigned integer value from an Attribute.


Find the Attribute with the supplied Attribute name that's stored in the Element and parse it 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
pAttributeNamePointer to a "C" string with the name of the Attribute
uDefaultValue to return on error
uMinMinimum acceptable value
uMaxMaximum acceptable value
Returns
Value in between uMin and uMax or uDefault
See also
AttributeGetInt(const char *,int_t,int_t,int_t) const, AttributeSetWord(const char *,uint_t), AttributeSetWordHex(const char *,uint_t), or AsciiToWord(const char *,uint_t,uint_t,uint_t)

◆ AttributeSetBoolean()

void BURGER_API Burger::FileXML::Element::AttributeSetBoolean ( const char * pAttributeName,
uint_t bValue )

Set an Attribute to a boolean value.


If the input value is zero, set the string to "no", otherwise set the string to "yes". It will not store numeric values.

If the Attribute already exists, it's updated. Otherwise, it will be created

Parameters
pAttributeNamePointer to a "C" string with the name of the Attribute
bValueValue to store as a string
See also
AttributeGetBoolean(const char *,uint_t) const

◆ AttributeSetDouble()

void BURGER_API Burger::FileXML::Element::AttributeSetDouble ( const char * pAttributeName,
double dValue )

Set a 64 bit floating point value to the Element's Attribute's value.


Convert the input into an floating point representation of a UTF-8 string and set the value to this string

Parameters
pAttributeNamePointer to a "C" string with the name of the Attribute
dValueValue to store as a 64 bit floating point string
See also
AttributeGetDouble(const char *,double,double,double) const or AttributeSetFloat(const char *,float)

◆ AttributeSetFloat()

void BURGER_API Burger::FileXML::Element::AttributeSetFloat ( const char * pAttributeName,
float fValue )

Set a 32 bit floating point value to the Element's Attribute's value.


Convert the input into an floating point representation of a UTF-8 string and set the value to this string

Parameters
pAttributeNamePointer to a "C" string with the name of the Attribute
fValueValue to store as a floating point string
See also
AttributeGetFloat(const char *,float,float,float) const or AttributeSetDouble(const char *,double)

◆ AttributeSetInt()

void BURGER_API Burger::FileXML::Element::AttributeSetInt ( const char * pAttributeName,
int_t iValue )

Set a signed integer value to the Element's Attribute's value.


Convert the input into an signed integer UTF-8 string and set the value to this string

Parameters
pAttributeNamePointer to a "C" string with the name of the Attribute
iValueValue to store as a signed integer string
See also
AttributeGetInt(const char *,int_t,int_t,int_t) const or AttributeSetWord(const char *,uint_t)

◆ AttributeSetString()

void BURGER_API Burger::FileXML::Element::AttributeSetString ( const char * pAttributeName,
const char * pValue )

Set the Element's Attribute object's value.


Replace the Element's Attribute's value string with this string.

If there isn't a Attribute object found, create one with this string.

Parameters
pAttributeNamePointer to a "C" string with the name of the Attribute
pValuePointer to a "C" string to copy into the RawText object
See also
AttributeGetString(const char *,const char *) const

◆ AttributeSetWord()

void BURGER_API Burger::FileXML::Element::AttributeSetWord ( const char * pAttributeName,
uint_t uValue )

Set an unsigned integer value to the Element's Attribute's value.


Convert the input into an unsigned integer UTF-8 string and set the value to this string

Parameters
pAttributeNamePointer to a "C" string with the name of the Attribute
uValueValue to store as an unsigned integer string
See also
AttributeGetWord(const char *,uint_t,uint_t,uint_t) const or AttributeSetWordHex(const char *,uint_t)

◆ AttributeSetWordHex()

void BURGER_API Burger::FileXML::Element::AttributeSetWordHex ( const char * pAttributeName,
uint_t uValue )

Set an unsigned integer value as hex to the Element's Attribute's value.


Convert the input into a "C" style hex string in the format of 0x12345678 and store this string as the value

Parameters
pAttributeNamePointer to a "C" string with the name of the Attribute
uValueValue to store as an unsigned integer hex string
See also
AttributeGetWord(const char *,uint_t,uint_t,uint_t) const or AttributeSetWord(const char *,uint_t)

◆ DeleteAttribute()

BURGER_INLINE void Burger::FileXML::Element::DeleteAttribute ( const char * pAttributeName)
inline

Delete an Attribute record.


Traverse the linked list for the Attribute with the supplied name and dispose of it.

Parameters
pAttributeNamePointer to a "C" string to the Attribute to search for.
See also
FindAttribute(const char *,uint_t) or AddAttribute(const char *,const char *)

◆ DeleteElement()

BURGER_INLINE void Burger::FileXML::Element::DeleteElement ( const char * pElementName)
inline

Delete an Element record.


Traverse the linked list for the first Element with the supplied name and dispose of it. It will stop after the first deletion. If there are multiple records with the same name, the duplicates will remain.

Parameters
pElementNamePointer to a "C" string to the element to search for.
See also
DeleteElements(const char *), FindElement(const char *,uint_t) or AddElement(const char *)

◆ DeleteElements()

BURGER_INLINE void Burger::FileXML::Element::DeleteElements ( const char * pElementName)
inline

Delete all Element records with this name.


Traverse the linked list for the all Element records with the supplied name and dispose of them.

Parameters
pElementNamePointer to a "C" string to the element to search for.
See also
DeleteElement(const char *), FindElement(const char *,uint_t) or AddElement(const char *)

◆ ElementGetBoolean()

uint_t BURGER_API Burger::FileXML::Element::ElementGetBoolean ( const char * pElementName,
uint_t bDefault ) const

Return a boolean value from an Element's RawText (TRUE or FALSE)


Find the Element with the supplied Element name that's stored in this Element and parse the RawText as a Boolean with "true", "yes" or non zero returning TRUE and "false", "no" or 0 returning FALSE.

If it's none of the above, then return the default value

Parameters
pElementName"C" string for the name of the Element to parse
bDefaultValue to return on error
Returns
TRUE or FALSE or bDefault
See also
ElementSetBoolean(const char *,uint_t) or AsciiToBoolean(const char *,uint_t)

◆ ElementGetDouble() [1/2]

double BURGER_API Burger::FileXML::Element::ElementGetDouble ( const char * pElementName,
double dDefault ) const

Return a 64 bit floating point value from an Element's RawText.


Find an Element with the supplied name and from the RawText that's stored in it parse it as a 64 bit floating point numeric value and if successful, return it. 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
pElementNamePointer to a "C" string with the name of the Element
dDefaultValue to return on error
Returns
Value or dDefault
See also
ElementGetFloat(const char *,float) const, ElementSetDouble(const char *,double) or AsciiToDouble(const char *,double)

◆ ElementGetDouble() [2/2]

double BURGER_API Burger::FileXML::Element::ElementGetDouble ( const char * pElementName,
double dDefault,
double dMin,
double dMax ) const

Return a 64 bit floating point value from an Element's RawText.


Find an Element with the supplied name and from the RawText that's stored in it parse it 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
pElementNamePointer to a "C" string with the name of the Element
dDefaultValue to return on error
dMinMinimum acceptable value
dMaxMaximum acceptable value
Returns
Value in between dMin and dMax or dDefault
See also
ElementGetFloat(const char *,float,float,float) const, ElementSetDouble(const char *,double) or AsciiToDouble(const char *,double,double,double)

◆ ElementGetFloat() [1/2]

float BURGER_API Burger::FileXML::Element::ElementGetFloat ( const char * pElementName,
float fDefault ) const

Return a floating point value from an Element's RawText.


Find an Element with the supplied name and from the RawText that's stored in it parse it as a 32 bit floating point numeric value and if successful, return it. 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
pElementNamePointer to a "C" string with the name of the Element
fDefaultValue to return on error
Returns
Value or fDefault
See also
ElementGetDouble(const char *,double) const, ElementSetFloat(const char *,float) or AsciiToFloat(const char *,float)

◆ ElementGetFloat() [2/2]

float BURGER_API Burger::FileXML::Element::ElementGetFloat ( const char * pElementName,
float fDefault,
float fMin,
float fMax ) const

Return a floating point value from an Element's RawText.


Find an Element with the supplied name and from the RawText that's stored in it parse it 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
pElementNamePointer to a "C" string with the name of the Element
fDefaultValue to return on error
fMinMinimum acceptable value
fMaxMaximum acceptable value
Returns
Value in between fMin and fMax or fDefault
See also
ElementGetDouble(const char *,double,double,double) const, ElementSetFloat(const char *,float) or AsciiToFloat(const char *,float,float,float)

◆ ElementGetInt()

int_t BURGER_API Burger::FileXML::Element::ElementGetInt ( const char * pElementName,
int_t iDefault,
int_t iMin = (- 0x7FFFFFFF )-1,
int_t iMax = 0x7FFFFFFF ) const

Return a signed integer value from an Element's RawText.


Find an Element with the supplied name and from the RawText that's stored in it parse it 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
pElementNamePointer to a "C" string with the name of the Element
iDefaultValue to return on error
iMinMinimum acceptable value
iMaxMaximum acceptable value
Returns
Value in between iMin and iMax or iDefault
See also
ElementGetWord(const char *,uint_t,uint_t,uint_t) const, ElementSetInt(const char *,int_t) or AsciiToInteger(const char *,int_t,int_t,int_t)

◆ ElementGetString()

const char *BURGER_API Burger::FileXML::Element::ElementGetString ( const char * pElementName,
const char * pDefault ) const

Locate and return the named Element's RawText text.


Return the pointer to the value of the named Element's first RawText object.

If it's not present, then return the default value

Parameters
pElementNamePointer to a "C" string with the name of the Element
pDefaultString to return on error
Returns
Pointer to the RawText string or pDefault
See also
ElementSetString(const char *,const char *)

◆ ElementGetWord()

uint_t BURGER_API Burger::FileXML::Element::ElementGetWord ( const char * pElementName,
uint_t uDefault,
uint_t uMin = 0,
uint_t uMax = 0xFFFFFFFFU ) const

Return an unsigned integer value from an Element's RawText.


Find an Element with the supplied name and from the RawText that's stored in it parse it 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
pElementNamePointer to a "C" string with the name of the Element
uDefaultValue to return on error
uMinMinimum acceptable value
uMaxMaximum acceptable value
Returns
Value in between uMin and uMax or uDefault
See also
ElementGetInt(const char *,int_t,int_t,int_t) const, ElementSetWord(const char *,uint_t), ElementSetWordHex(const char *,uint_t), or AsciiToWord(const char *,uint_t,uint_t,uint_t)

◆ ElementSetBoolean()

void BURGER_API Burger::FileXML::Element::ElementSetBoolean ( const char * pElementName,
uint_t bValue )

Set an Element's RawText to a boolean value.


If the input value is zero, set the RawText attached to the Element to "no", otherwise set the RawText to "yes". It will not store numeric values.

If the Element already exists, it's updated. Otherwise, it will be created

Parameters
pElementNamePointer to a "C" string with the name of the Element
bValueValue to store as a string
See also
ElementGetBoolean(const char *,uint_t) const

◆ ElementSetDouble()

void BURGER_API Burger::FileXML::Element::ElementSetDouble ( const char * pElementName,
double dValue )

Set a 64 bit floating point value into a named Element's RawText.


Convert the input into an floating point representation of a UTF-8 string and set the value to this string

Parameters
pElementNamePointer to a "C" string with the name of the Element
dValueValue to store as a 64 bit floating point string
See also
ElementGetDouble(const char *,double,double,double) const or ElementSetFloat(const char *,float)

◆ ElementSetFloat()

void BURGER_API Burger::FileXML::Element::ElementSetFloat ( const char * pElementName,
float fValue )

Set a 32 bit floating point value into a named Element's RawText.


Convert the input into an floating point representation of a UTF-8 string and set the value to this string

Parameters
pElementNamePointer to a "C" string with the name of the Element
fValueValue to store as a floating point string
See also
ElementGetFloat(const char *,float,float,float) const or ElementSetDouble(const char *,double)

◆ ElementSetInt()

void BURGER_API Burger::FileXML::Element::ElementSetInt ( const char * pElementName,
int_t iValue )

Set a signed integer value into a named Element's RawText.


Convert the input into an signed integer UTF-8 string and set the value to this string

Parameters
pElementNamePointer to a "C" string with the name of the Element
iValueValue to store as a signed integer string
See also
ElementGetInt(const char *,int_t,int_t,int_t) const or ElementSetWord(const char *,uint_t)

◆ ElementSetString()

void BURGER_API Burger::FileXML::Element::ElementSetString ( const char * pElementName,
const char * pValue )

Set the the named Element's RawText string.


Replace the named Element's first RawText string with this string.

If there isn't a Element object by this name found, create one with this string.

Parameters
pElementNamePointer to a "C" string with the name of the Element
pValuePointer to a "C" string to copy into the RawText object
See also
ElementGetString(const char *,const char *) const

◆ ElementSetWord()

void BURGER_API Burger::FileXML::Element::ElementSetWord ( const char * pElementName,
uint_t uValue )

Set an unsigned integer value into a named Element's RawText.


Convert the input into an unsigned integer UTF-8 string and set the value to this string

Parameters
pElementNamePointer to a "C" string with the name of the Element
uValueValue to store as an unsigned integer string
See also
ElementGetWord(const char *,uint_t,uint_t,uint_t) const or ElementSetWordHex(const char *,uint_t)

◆ ElementSetWordHex()

void BURGER_API Burger::FileXML::Element::ElementSetWordHex ( const char * pElementName,
uint_t uValue )

Set an unsigned integer value as hex into a named Element's RawText.


Convert the input into a "C" style hex string in the format of 0x12345678 and store this string as the value

Parameters
pElementNamePointer to a "C" string with the name of the Element
uValueValue to store as an unsigned integer hex string
See also
ElementGetWord(const char *,uint_t,uint_t,uint_t) const or ElementSetWord(const char *,uint_t)

◆ FindAttribute()

BURGER_INLINE Attribute * Burger::FileXML::Element::FindAttribute ( const char * pAttributeName,
uint_t bAlwaysCreate = 0 )
inline

Traverse the linked list and find a specific named Attribute.


Iterate over the Element's linked list until an Attribute is found. Return NULL if the Attribute is not found or the pointer to the occurrence of the named Attribute using a case sensitive string compare.

Parameters
pAttributeNamePointer to a "C" string to the Attribute to search for.
bAlwaysCreateTRUE to create the Attribute if one didn't already exist
Returns
Pointer to an XML Attribute or NULL if not found
See also
DeleteAttribute() or AddAttribute()

◆ FindElement() [1/2]

BURGER_INLINE const Element * Burger::FileXML::Element::FindElement ( const char * pElementName) const
inline

Find a named XML Element.


Traverse the linked list for an XML Element record with the matching name using a case sensitive search. Return NULL if the record wasn't found.

Parameters
pElementNamePointer to a "C" string to the element to search for.
Returns
Pointer to an XML Element or NULL if not found
See also
DeleteElement() or AddElement()

◆ FindElement() [2/2]

BURGER_INLINE Element * Burger::FileXML::Element::FindElement ( const char * pElementName,
uint_t bAlwaysCreate = 0 )
inline

Find a named XML Element.


Traverse the linked list for an XML Element record with the matching name using a case sensitive search. Return NULL if the record wasn't found and bAlwaysCreate is zero. If bAlwaysCreate is not zero and the record didn't exist, create one.

Parameters
pElementNamePointer to a "C" string to the element to search for.
bAlwaysCreateTRUE to create the Element if one didn't already exist
Returns
Pointer to an XML Element or NULL if not found
See also
DeleteElement() or AddElement()

◆ GetBoolean()

uint_t BURGER_API Burger::FileXML::Element::GetBoolean ( uint_t bDefault) const

Return a boolean value from the Element's RawText (TRUE or FALSE)


Find the first RawText field stored in the Element and parse it as a Boolean with "true", "yes" or non zero returning TRUE and "false", "no" or 0 returning FALSE.

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() [1/2]

double BURGER_API Burger::FileXML::Element::GetDouble ( double dDefault) const

Return a 64 bit floating point value from the Element's RawText.


Find the first RawText field stored in the Element and parse it as a 64 bit floating point numeric value and if successful, return it. 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
Returns
Value or dDefault
See also
GetFloat(float) const, SetDouble(double) or AsciiToDouble(const char *,double)

◆ GetDouble() [2/2]

double BURGER_API Burger::FileXML::Element::GetDouble ( double dDefault,
double dMin,
double dMax ) const

Return a 64 bit floating point value from the Element's RawText.


Find the first RawText field stored in the Element and parse it 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() [1/2]

float BURGER_API Burger::FileXML::Element::GetFloat ( float fDefault) const

Return a floating point value from the Element's RawText.


Find the first RawText field stored in the Element and parse it as a 32 bit floating point numeric value and if successful, return it. 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
Returns
Value or fDefault
See also
GetDouble(double) const, SetFloat(float) or AsciiToFloat(const char *,float)

◆ GetFloat() [2/2]

float BURGER_API Burger::FileXML::Element::GetFloat ( float fDefault,
float fMin,
float fMax ) const

Return a floating point value from the Element's RawText.


Find the first RawText field stored in the Element and parse it 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::FileXML::Element::GetInt ( int_t iDefault,
int_t iMin = (- 0x7FFFFFFF )-1,
int_t iMax = 0x7FFFFFFF ) const

Return a signed integer value from the Element's RawText.


Find the first RawText field stored in the Element and parse it 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)

◆ GetName()

const char * Burger::FileXML::Element::GetName ( void ) const
inline

Return a pointer to the element's name.


See also
SetName(const char *) or SetName(const String *)

◆ GetRoot() [1/2]

BURGER_INLINE Root * Burger::FileXML::Element::GetRoot ( void )
inline

Return the root object.


Return the root object that contains all objects this Element for manual parsing.

Returns
Pointer to the root object contained in this Element.
See also
GetRoot(void) const

◆ GetRoot() [2/2]

BURGER_INLINE const Root * Burger::FileXML::Element::GetRoot ( void ) const
inline

Return the const root object.


Return the root object that contains all objects this Element for manual parsing.

Returns
Pointer to the root object contained in this Element.
See also
GetRoot(void)

◆ GetString()

const char *BURGER_API Burger::FileXML::Element::GetString ( const char * pDefault) const

Locate and return the Element's RawText.


Return the string pointer to the Element's first RawText object.

If it's not present, then return the default value

Parameters
pDefaultString to return on error
Returns
Pointer to the RawText string or pDefault
See also
SetString(const char *)

◆ GetWord()

uint_t BURGER_API Burger::FileXML::Element::GetWord ( uint_t uDefault,
uint_t uMin = 0,
uint_t uMax = 0xFFFFFFFFU ) const

Return an unsigned integer value from the Element's RawText.


Find the first RawText field stored in the Element and parse it 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::FileXML::Element *BURGER_API Burger::FileXML::Element::New ( const char * pName)
static

Create a new Element structure and initialize its name.


Allocate memory for a new Element and set the name.

Parameters
pNamePointer to a "C" string with the name of the element
Returns
NULL on error or a valid Element record

◆ New() [2/2]

Burger::FileXML::Element *BURGER_API Burger::FileXML::Element::New ( InputMemoryStream * pInput)
static

Create a new Element structure and initialize it from an input file.


Parse the input file after the starting < and up to and including the ending /> or > followed by internal data and the following </endname>

Will return NULL on a parsing error or if it's out of memory

Parameters
pInputPointer to an input stream at the byte after the <
Returns
NULL on error or a valid Element record on a successful parse

◆ Parse()

uint_t Burger::FileXML::Element::Parse ( InputMemoryStream * pInput)
virtual

Parse an XML Element object.


Parameters
pInputPointer to the input text stream
Returns
Zero if no error, non-zero on error
See also
Save(OutputMemoryStream *)

Reimplemented from Burger::FileXML::Generic.

◆ Save()

uint_t Burger::FileXML::Element::Save ( OutputMemoryStream * pOutput,
uint_t uDepth ) const
virtual

Write out an XML Element object.


Parameters
pOutputPointer to the output text stream
uDepthNumber of tabs to output for formatting before writing out the element
Returns
Zero if no error, non-zero on error
See also
Parse(InputMemoryStream *)

Reimplemented from Burger::FileXML::Generic.

◆ SetBoolean()

void BURGER_API Burger::FileXML::Element::SetBoolean ( uint_t bValue)

Set the RawText in the Element to a boolean value.


If the input value is zero, set the string to "no", otherwise set the string to "yes". It will not store numeric values.

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

◆ SetDouble()

void BURGER_API Burger::FileXML::Element::SetDouble ( double dValue)

Set a 64 bit floating point value to the Element's RawText.


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::FileXML::Element::SetFloat ( float fValue)

Set a 32 bit floating point value to the Element's RawText.


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::FileXML::Element::SetInt ( int_t iValue)

Set a signed integer value to the Element's RawText.


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)

◆ SetName() [1/2]

void Burger::FileXML::Element::SetName ( const char * pInput)
inline

Set the name of the element.


Replace the element's name with the supplied "C" string.

Parameters
pInputPointer to a "C" string
See also
GetName(void) const or SetName(const String *)

◆ SetName() [2/2]

void Burger::FileXML::Element::SetName ( const String * pInput)
inline

Set the name of the element.


Replace the element's name with the supplied String.

Parameters
pInputPointer to a String class instance
See also
GetName(void) const or SetName(const char *)

◆ SetString()

void BURGER_API Burger::FileXML::Element::SetString ( const char * pValue)

Set the Element's RawText object.


Replace the Element's first RawText object's text with this string.

If there isn't a RawText object found, create one with this string.

Parameters
pValuePointer to a "C" string to copy into the RawText object
See also
GetString(const char *) const

◆ SetWord()

void BURGER_API Burger::FileXML::Element::SetWord ( uint_t uValue)

Set an unsigned integer value to the Element's RawText.


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::FileXML::Element::SetWordHex ( uint_t uValue)

Set an unsigned integer value as hex to the Element's RawText.


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_Attributes

Root Burger::FileXML::Element::m_Attributes
private

Linked list root for all attached attributes.

◆ m_Name

String Burger::FileXML::Element::m_Name
private

Name of the element.

◆ m_Root

Root Burger::FileXML::Element::m_Root
private

Linked list root for all contained objects.