Static Public Member Functions | |
static Element * | New (InputMemoryStream *pInput) |
Create a new Element structure and initialize it from an input file. | |
static Element * | New (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. | |
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.
Burger::FileXML::Element::Element | ( | ) |
Create an empty element object.
Create an empty element object.
pName | Pointer to a "C" string for the element's name |
|
virtual |
Call the destructor for a Element object.
Unlink itself from the linked list and release the contained strings
|
inline |
Add a new Attribute record.
Create a new Attribute and place it as the last record in the Element's Attribute list.
|
inline |
Add a new Element record.
Create a new Element and place it as the last record in the Element's list.
pElementName | Pointer to a "C" string to the element to search for. |
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
pAttributeName | "C" string for the name of the Attribute to parse |
bDefault | Value to return on error |
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.
pAttributeName | Pointer to a "C" string with the name of the Attribute |
dDefault | Value to return on error |
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.
pAttributeName | Pointer to a "C" string with the name of the Attribute |
dDefault | Value to return on error |
dMin | Minimum acceptable value |
dMax | Maximum acceptable value |
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.
pAttributeName | Pointer to a "C" string with the name of the Attribute |
fDefault | Value to return on error |
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.
pAttributeName | Pointer to a "C" string with the name of the Attribute |
fDefault | Value to return on error |
fMin | Minimum acceptable value |
fMax | Maximum acceptable value |
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.
pAttributeName | Pointer to a "C" string with the name of the Attribute |
iDefault | Value to return on error |
iMin | Minimum acceptable value |
iMax | Maximum acceptable value |
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
pAttributeName | Pointer to a "C" string with the name of the Attribute |
pDefault | String to return on error |
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
pAttributeName | Pointer to a "C" string with the name of the Attribute |
uDefault | Value to return on error |
uMin | Minimum acceptable value |
uMax | Maximum acceptable value |
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
pAttributeName | Pointer to a "C" string with the name of the Attribute |
bValue | Value to store as a string |
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
pAttributeName | Pointer to a "C" string with the name of the Attribute |
dValue | Value to store as a 64 bit floating point string |
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
pAttributeName | Pointer to a "C" string with the name of the Attribute |
fValue | Value to store as a floating point string |
void BURGER_API Burger::FileXML::Element::AttributeSetInt | ( | const char * | pAttributeName, |
int_t | iValue ) |
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.
void BURGER_API Burger::FileXML::Element::AttributeSetWord | ( | const char * | pAttributeName, |
uint_t | uValue ) |
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
pAttributeName | Pointer to a "C" string with the name of the Attribute |
uValue | Value to store as an unsigned integer hex string |
|
inline |
|
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.
pElementName | Pointer to a "C" string to the element to search for. |
|
inline |
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
pElementName | "C" string for the name of the Element to parse |
bDefault | Value to return on error |
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.
pElementName | Pointer to a "C" string with the name of the Element |
dDefault | Value to return on error |
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.
pElementName | Pointer to a "C" string with the name of the Element |
dDefault | Value to return on error |
dMin | Minimum acceptable value |
dMax | Maximum acceptable value |
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.
pElementName | Pointer to a "C" string with the name of the Element |
fDefault | Value to return on error |
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.
pElementName | Pointer to a "C" string with the name of the Element |
fDefault | Value to return on error |
fMin | Minimum acceptable value |
fMax | Maximum acceptable value |
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.
pElementName | Pointer to a "C" string with the name of the Element |
iDefault | Value to return on error |
iMin | Minimum acceptable value |
iMax | Maximum acceptable value |
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
pElementName | Pointer to a "C" string with the name of the Element |
pDefault | String to return on error |
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
pElementName | Pointer to a "C" string with the name of the Element |
uDefault | Value to return on error |
uMin | Minimum acceptable value |
uMax | Maximum acceptable value |
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
pElementName | Pointer to a "C" string with the name of the Element |
bValue | Value to store as a string |
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
pElementName | Pointer to a "C" string with the name of the Element |
dValue | Value to store as a 64 bit floating point string |
void BURGER_API Burger::FileXML::Element::ElementSetFloat | ( | const char * | pElementName, |
float | fValue ) |
void BURGER_API Burger::FileXML::Element::ElementSetInt | ( | const char * | pElementName, |
int_t | iValue ) |
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.
void BURGER_API Burger::FileXML::Element::ElementSetWord | ( | const char * | pElementName, |
uint_t | uValue ) |
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
pElementName | Pointer to a "C" string with the name of the Element |
uValue | Value to store as an unsigned integer hex string |
|
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.
pAttributeName | Pointer to a "C" string to the Attribute to search for. |
bAlwaysCreate | TRUE to create the Attribute if one didn't already exist |
|
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.
pElementName | Pointer to a "C" string to the element to search for. |
|
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.
pElementName | Pointer to a "C" string to the element to search for. |
bAlwaysCreate | TRUE to create the Element if one didn't already exist |
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
bDefault | Value to return on error |
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.
dDefault | Value to return on error |
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.
dDefault | Value to return on error |
dMin | Minimum acceptable value |
dMax | Maximum acceptable value |
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.
fDefault | Value to return on error |
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.
fDefault | Value to return on error |
fMin | Minimum acceptable value |
fMax | Maximum acceptable value |
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.
iDefault | Value to return on error |
iMin | Minimum acceptable value |
iMax | Maximum acceptable value |
|
inline |
Return the root object.
Return the root object that contains all objects this Element for manual parsing.
|
inline |
Return the const root object.
Return the root object that contains all objects this Element for manual parsing.
const char *BURGER_API Burger::FileXML::Element::GetString | ( | const char * | pDefault | ) | const |
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
uDefault | Value to return on error |
uMin | Minimum acceptable value |
uMax | Maximum acceptable value |
|
static |
|
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
pInput | Pointer to an input stream at the byte after the < |
|
virtual |
Parse an XML Element object.
pInput | Pointer to the input text stream |
Reimplemented from Burger::FileXML::Generic.
|
virtual |
Write out an XML Element object.
pOutput | Pointer to the output text stream |
uDepth | Number of tabs to output for formatting before writing out the element |
Reimplemented from Burger::FileXML::Generic.
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.
bValue | Value to store as a string |
void BURGER_API Burger::FileXML::Element::SetDouble | ( | double | dValue | ) |
void BURGER_API Burger::FileXML::Element::SetFloat | ( | float | fValue | ) |
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
iValue | Value to store as a signed integer string |
Set the name of the element.
Replace the element's name with the supplied "C" string.
pInput | Pointer to a "C" string |
Set the name of the element.
Replace the element's name with the supplied String.
pInput | Pointer to a String class instance |
void BURGER_API Burger::FileXML::Element::SetString | ( | const char * | pValue | ) |
void BURGER_API Burger::FileXML::Element::SetWord | ( | uint_t | uValue | ) |
void BURGER_API Burger::FileXML::Element::SetWordHex | ( | uint_t | uValue | ) |
|
private |
Linked list root for all attached attributes.
|
private |
Name of the element.
|
private |
Linked list root for all contained objects.