Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::FileXML::Root Class Reference

Linked list root object. More...

Inheritance diagram for Burger::FileXML::Root:
Collaboration diagram for Burger::FileXML::Root:

Public Member Functions

 Root ()
 Create an empty root object.
 
virtual ~Root ()
 Call the destructor for a Root object.
 
uint_t ParseList (InputMemoryStream *pInput, uint_t bAllowRawText=0)
 Parse XML objects from an XML text stream.
 
uint_t SaveList (OutputMemoryStream *pOutput, uint_t uDepth) const
 Output all objects in a linked list.
 
void DeleteList (void)
 Dispose of all objects in a linked list.
 
GenericFindType (eType uType) const
 Traverse the linked list and find a specific type.
 
void DeleteType (eType uType)
 Traverse the linked list and delete all objects of a specific type.
 
const ElementFindElement (const char *pElementName) const
 Traverse the linked list and find a specific named Element.
 
ElementFindElement (const char *pElementName, uint_t bAlwaysCreate=0)
 Traverse the linked list and find a specific named Element.
 
ElementAddElement (const char *pElementName)
 Allocate memory for a new Element and append it to the end of this list.
 
void DeleteElement (const char *pElementName)
 Traverse the linked list and delete a specific named Element.
 
void DeleteElements (const char *pElementName)
 Traverse the linked list and delete all Element objects of a specific name.
 
const AttributeFindAttribute (const char *pAttributeName) const
 Traverse the linked list and find a specific named Attribute.
 
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)
 Allocate memory for a new Attribute and append it to the end of this list.
 
void DeleteAttribute (const char *pAttributeName)
 Traverse the linked list and delete a specific named Attribute.
 
const RawTextFindRawText (void) const
 Traverse the linked list and find the first occurrence of RawText.
 
RawTextFindRawText (uint_t bAlwaysCreate=0)
 Traverse the linked list and find the first occurrence of RawText.
 
RawTextAddRawText (const char *pValue=0)
 Allocate memory for a new RawText and append it to the end of this list.
 
void DeleteRawText (void)
 Traverse the linked list and delete the first RawText entry located.
 
- Public Member Functions inherited from Burger::FileXML::Generic
 Generic (eType uType)
 Initialize a generic object.
 
virtual ~Generic ()
 Call the destructor for a generic object.
 
virtual uint_t Parse (InputMemoryStream *pInput)
 Parse data from a data stream.
 
virtual uint_t Save (OutputMemoryStream *pOutput, uint_t uDepth) const
 Write data to a data stream.
 
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 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.
 

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

Linked list root object.


For every object that can contain other object, this object is the anchor that is the start and end of the linked list of contained object.

This object contains no data per se, only a list of other objects.

Note
This will identify with eType of XML_ROOT
See also
Burger::FileXML, Burger::FileXML::Generic, Burger::FileXML::Element or Burger::FileXML::Declaration

Constructor & Destructor Documentation

◆ Root()

Burger::FileXML::Root::Root ( )

Create an empty root object.


◆ ~Root()

Burger::FileXML::Root::~Root ( )
virtual

Call the destructor for a Root object.


Dispose of all objects still under this object's control

Member Function Documentation

◆ AddAttribute()

Burger::FileXML::Attribute *BURGER_API Burger::FileXML::Root::AddAttribute ( const char * pAttributeName,
const char * pValue = 0 )

Allocate memory for a new Attribute and append it to the end of this list.


If an attribute of the same name exists in the host linked list, the pointer to the pre-existing attribute is updated.

Parameters
pAttributeNamePointer to a "C" string of the name of the attribute to create.
pValuePointer to a "C" string of the name of the value for the attribute.
Returns
NULL if there was a memory allocation error or a valid pointer to the newly created Attribute.

◆ AddElement()

Burger::FileXML::Element *BURGER_API Burger::FileXML::Root::AddElement ( const char * pElementName)

Allocate memory for a new Element and append it to the end of this list.


No attempt is made to determine if there are other elements with the same name.

Parameters
pElementNamePointer to a "C" string of the name of the element to create.
Returns
NULL if there was a memory allocation error or a valid pointer to the newly created Element.

◆ AddRawText()

Burger::FileXML::RawText *BURGER_API Burger::FileXML::Root::AddRawText ( const char * pValue = 0)

Allocate memory for a new RawText and append it to the end of this list.


This will append a new record without checking if one already exists

Parameters
pValuePointer to a "C" string of the value of the new text.
Returns
NULL if there was a memory allocation error or a valid pointer to the newly created RawText.

◆ DeleteAttribute()

void BURGER_API Burger::FileXML::Root::DeleteAttribute ( const char * pAttributeName)

Traverse the linked list and delete a specific named Attribute.


Parameters
pAttributeNamePointer to a "C" string of the name of the attribute to look for.

◆ DeleteElement()

void BURGER_API Burger::FileXML::Root::DeleteElement ( const char * pElementName)

Traverse the linked list and delete a specific named Element.


Note
This will only delete the FIRST occurrence of a named element. If there are multiple copies, the remaining elements will be retained.
Parameters
pElementNamePointer to a "C" string of the name of the element to look for.
See also
DeleteElements()

◆ DeleteElements()

void BURGER_API Burger::FileXML::Root::DeleteElements ( const char * pElementName)

Traverse the linked list and delete all Element objects of a specific name.


Iterate over the XML objects linked list and delete all Element objects of the requested name.

Parameters
pElementNamePointer to a "C" string to the Element's name (Can be multiple elements)
See also
DeleteElement()

◆ DeleteList()

void BURGER_API Burger::FileXML::Root::DeleteList ( void )

Dispose of all objects in a linked list.


Assume the current object is a root object and iterate over all of the other XML objects linked to it and delete them.

◆ DeleteRawText()

void BURGER_API Burger::FileXML::Root::DeleteRawText ( void )

Traverse the linked list and delete the first RawText entry located.


◆ DeleteType()

void BURGER_API Burger::FileXML::Root::DeleteType ( eType uType)

Traverse the linked list and delete all objects of a specific type.


Iterate over the XML objects linked list and delete all objects of the requested type.

Parameters
uTypeType enumeration to scan for.

◆ FindAttribute() [1/2]

const Burger::FileXML::Attribute *BURGER_API Burger::FileXML::Root::FindAttribute ( const char * pAttributeName) const

Traverse the linked list and find a specific named Attribute.


Iterate over the XML objects linked list until an object of type XML_ROOT is found and abort. Return NULL if the element is not found or the pointer to the next occurrence of the named Attribute using a case sensitive string compare.

Parameters
pAttributeNamePointer to a "C" string of the name of the attribute to look for.
Returns
NULL if the attribute was not found or a valid pointer to the occurrence of an Attribute with the requested name.

◆ FindAttribute() [2/2]

Burger::FileXML::Attribute *BURGER_API Burger::FileXML::Root::FindAttribute ( const char * pAttributeName,
uint_t bAlwaysCreate = 0 )

Traverse the linked list and find a specific named Attribute.


Iterate over the XML objects linked list until an object of type XML_ROOT is found and abort. Return NULL if the element is not found or the pointer to the next occurrence of the named Attribute using a case sensitive string compare.

Parameters
pAttributeNamePointer to a "C" string of the name of the attribute to look for.
bAlwaysCreateTRUE if the object can't be found, create an empty record instead
Returns
NULL if the attribute was not found or a valid pointer to the occurrence of an Attribute with the requested name.

◆ FindElement() [1/2]

const Burger::FileXML::Element *BURGER_API Burger::FileXML::Root::FindElement ( const char * pElementName) const

Traverse the linked list and find a specific named Element.


Iterate over the XML objects linked list until an object of type XML_ROOT is found and abort. Return NULL if the element is not found or the pointer to the next occurrence of the named Element using a case sensitive string compare.

Parameters
pElementNamePointer to a "C" string of the name of the element to look for.
Returns
NULL if the element was not found or a valid pointer to the first occurrence of the an Element with the requested name.

◆ FindElement() [2/2]

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

Traverse the linked list and find a specific named Element.


Iterate over the XML objects linked list until an object of type XML_ROOT is found and abort. Return NULL if the element is not found or the pointer to the next occurrence of the named Element using a case sensitive string compare.

Parameters
pElementNamePointer to a "C" string of the name of the element to look for.
bAlwaysCreateTRUE if the object can't be found, create an empty record instead
Returns
NULL if the element was not found or a valid pointer to the first occurrence of the an Element with the requested name.

◆ FindRawText() [1/2]

Burger::FileXML::RawText *BURGER_API Burger::FileXML::Root::FindRawText ( uint_t bAlwaysCreate = 0)

Traverse the linked list and find the first occurrence of RawText.


Iterate over the XML objects linked list until an object of type XML_ROOT is found and abort. Return NULL if the element is not found or the pointer to the next occurrence of the named RawText using a case sensitive string compare.

Parameters
bAlwaysCreateTRUE if the object can't be found, create an empty record instead
Returns
NULL if the raw text was not found or a valid pointer to the occurrence of the RawText if found or created.

◆ FindRawText() [2/2]

const Burger::FileXML::RawText *BURGER_API Burger::FileXML::Root::FindRawText ( void ) const

Traverse the linked list and find the first occurrence of RawText.


Iterate over the XML objects linked list until an object of type XML_ROOT is found and abort. Return NULL if the element is not found or the pointer to the next occurrence of the named RawText using a case sensitive string compare.

Returns
NULL if the raw text was not found or a valid pointer to the occurrence of the RawText found.

◆ FindType()

Burger::FileXML::Generic *BURGER_API Burger::FileXML::Root::FindType ( eType uType) const

Traverse the linked list and find a specific type.


Iterate over the XML objects linked list until an object of type XML_ROOT is found and return NULL. If the element of the requested type is found, return the pointer to the Element.

Parameters
uTypeType enumeration to scan for.
Returns
NULL if the element was not found or a valid pointer to the an Element with the requested type.

◆ ParseList()

uint_t BURGER_API Burger::FileXML::Root::ParseList ( InputMemoryStream * pInput,
uint_t bAllowRawText = 0 )

Parse XML objects from an XML text stream.


Parse the text and create XML objects based on the input. If there is an error in parsing, return a non-zero error code.

Parsing will continue until the end of input or a <// end parse token is found.

Note
This function can be called recursively due to Elements parsing Elements within themselves.
Parameters
pInputPointer to an input stream
bAllowRawTextIf TRUE, then non-encapsulated text is allowed to be parsed since an Element is currently being parsed.
Returns
Error code of zero for no error or non-zero on error
See also
SaveList(OutputMemoryStream *,uint_t) const

◆ SaveList()

uint_t BURGER_API Burger::FileXML::Root::SaveList ( OutputMemoryStream * pOutput,
uint_t uDepth ) const

Output all objects in a linked list.


Assume the current object is a root object and iterate over all of the other XML objects linked to it and save the contents to an output stream.

Parameters
pOutputPointer to an output stream
uDepthNumber of tabs to output before saving out this record
Returns
Error code of zero for no error or non-zero on error
See also
Save(OutputMemoryStream *,uint_t) const