Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cXmlContainer Class Referenceabstract

#include <cXmlDocument.h>

Inheritance diagram for GrayLib::cXmlContainer:
Gray::cListT< cXmlNode > GrayLib::cXml Gray::cListBase GrayLib::cXmlDocument GrayLib::cXmlElement

Public Member Functions

virtual ~cXmlContainer ()
 
virtual cXmlNodeToNode ()=0
 cast cXmlContainer is a cXmlDocument or cXmlElement More...
 
cXmlNodeGetChildFirst (const char *value) const
 The first child of this node with the matching 'value'. Will be null if none found. More...
 
cXmlNodeGetChildLast (const char *value) const
 The last child of this node matching 'value'. Will be null if there are no children. More...
 
cXmlNodeIterateChildren (const char *value, const cXmlNode *previous) const
 This flavor of IterateChildren searches for children with a particular 'value'. More...
 
HRESULT LinkChildEnd (cXmlNode *addThis)
 
void SetCopyChildren (const cXmlContainer &cont)
 
cXmlNodeInsertChildEnd (const cXmlNode &addThis)
 
cXmlNodeInsertChildAfter (cXmlNode *afterThis, const cXmlNode &addThis)
 
cXmlNodeInsertChildBefore (cXmlNode *beforeThis, const cXmlNode &addThis)
 
bool RemoveChild (cXmlNode *removeThis)
 Delete a child of this node. More...
 
cXmlElementget_FirstChildElement () const
 Convenience function to get through elements. More...
 
cXmlElementGetFirstChildElement (const char *pszValue) const
 Convenience function to get through elements. More...
 
- Public Member Functions inherited from Gray::cListT< cXmlNode >
cXmlNode * GetAt (ITERATE_t index) const
 
cXmlNode * get_Head () const
 
cXmlNode * get_Tail () const
 
- Public Member Functions inherited from Gray::cListBase
 cListBase () noexcept
 
virtual ~cListBase ()
 
virtual void InsertListNode (cListNodeBase *pNodeNew, cListNodeBase *pNodePrev=nullptr)
 
void InsertList (cListBase *pListSrc, cListNodeBase *pNodePrev=nullptr)
 
void InsertBefore (cListNodeBase *pNodeNew, const cListNodeBase *pNodeNext)
 
void InsertHead (cListNodeBase *pNodeNew)
 
void InsertTail (cListNodeBase *pNodeNew)
 
void DisposeAll ()
 
void Empty ()
 
cListNodeBaseget_Head (void) const noexcept
 
cListNodeBaseget_Tail (void) const noexcept
 
ITERATE_t get_Count () const noexcept
 
bool isEmpty () const noexcept
 
cListNodeBaseGetAt (ITERATE_t index) const
 iterate the linked list. More...
 
bool IsMyChild (const cListNodeBase *pNode) const noexcept
 

Additional Inherited Members

- Public Types inherited from GrayLib::cXml
enum  XMLNODE_TYPE { XMLNODE_QTY }
 
- Static Public Member Functions inherited from GrayLib::cXml
static StrLen_t GRAYCALL ParseMicrosoftBOM (const BYTE *pszData)
 
static bool GRAYCALL IsXML (const IniChar_t *pszStr, StrLen_t iLenMax=StrT::k_LEN_MAX)
 
static cXmlString GRAYCALL GetAttributeStr (const IniChar_t *pszName, const cXmlString &sValue)
 
static void AddPathElement (cXmlString &sPath, const cXmlString &sElement)
 
static void RemovePathElement (cXmlString &sPath, const cXmlString &sElement)
 
- Static Public Attributes inherited from GrayLib::cXml
static const char k_xmlHeader [6] = "<?xml"
 "<?xml" // not case sensitive ! More...
 
static const char k_xmlEnd [3] = "?>"
 "?>" More...
 
static const char k_commentHeader [5] = "<!--"
 "<!--" // comments are not reentrant! More...
 
static const char k_commentEnd [4] = "-->"
 "-->" More...
 
static const char k_cdataHeader [10] = "<![CDATA["
 "<![CDATA[" More...
 
static const char k_cdataEnd [4] = "]]>"
 "]]>" More...
 
static const char k_dtdHeader [3] = "<!"
 "<!" More...
 
- Protected Member Functions inherited from Gray::cListBase
virtual void RemoveListNode (cListNodeBase *pNode)
 allow Override of this. called when child pObRec removed from list. More...
 
- Protected Attributes inherited from Gray::cListBase
ITERATE_t m_iCount
 how many children? nice to get read only direct access to this for scripting. More...
 

Detailed Description

Document, Element node types may contain child cXmlNode(s).

Constructor & Destructor Documentation

◆ ~cXmlContainer()

virtual GrayLib::cXmlContainer::~cXmlContainer ( )
inlinevirtual

Member Function Documentation

◆ get_FirstChildElement()

cXmlElement * GrayLib::cXmlContainer::get_FirstChildElement ( ) const

Convenience function to get through elements.

◆ GetChildFirst()

cXmlNode * GrayLib::cXmlContainer::GetChildFirst ( const char *  value) const

The first child of this node with the matching 'value'. Will be null if none found.

◆ GetChildLast()

cXmlNode * GrayLib::cXmlContainer::GetChildLast ( const char *  value) const

The last child of this node matching 'value'. Will be null if there are no children.

◆ GetFirstChildElement()

cXmlElement * GrayLib::cXmlContainer::GetFirstChildElement ( const char *  pszValue) const

Convenience function to get through elements.

◆ InsertChildAfter()

cXmlNode * GrayLib::cXmlContainer::InsertChildAfter ( cXmlNode afterThis,
const cXmlNode addThis 
)

Add a new node related to this. Adds a child after the specified child. Returns a pointer to the new object or nullptr if an error occurred.

Copy this node into the child list.

◆ InsertChildBefore()

cXmlNode * GrayLib::cXmlContainer::InsertChildBefore ( cXmlNode beforeThis,
const cXmlNode addThis 
)

Add a new node related to this. Adds a child before the specified child. Returns a pointer to the new object or nullptr if an error occurred.

Copy this node into the child list.

◆ InsertChildEnd()

cXmlNode * GrayLib::cXmlContainer::InsertChildEnd ( const cXmlNode addThis)

Add a new node related to this. Adds a child past the LastChild.

Returns
a pointer to the new object or nullptr if an error occurred.

Copy this node into the child list.

◆ IterateChildren()

cXmlNode * GrayLib::cXmlContainer::IterateChildren ( const char *  value,
const cXmlNode previous 
) const

This flavor of IterateChildren searches for children with a particular 'value'.

An alternate way to walk the children of a node. One way to iterate over nodes is:

//! for( child = parent->FirstChild(); child; child = child->NextSibling())
//! 
IterateChildren does the same thing with the syntax:
@verbatim

//! child = 0; //! while( child = parent->IterateChildren( child )) //!

IterateChildren takes the previous child as input and finds
the next one. If the previous child is null, it returns the
first. IterateChildren will return null when done. 

◆ LinkChildEnd()

HRESULT GrayLib::cXmlContainer::LinkChildEnd ( cXmlNode addThis)

Add a new node related to this. Adds a child past the LastChild.

Note
the node to be added is passed by pointer, and will be henceforth owned (and deleted) by cXml. This method is efficient and avoids an extra copy, but should be used with care as it uses a different memory model than the other insert functions.
See also
InsertChildEnd

◆ RemoveChild()

bool GrayLib::cXmlContainer::RemoveChild ( cXmlNode removeThis)

Delete a child of this node.

◆ SetCopyChildren()

void GrayLib::cXmlContainer::SetCopyChildren ( const cXmlContainer cont)

◆ ToNode()

virtual cXmlNode* GrayLib::cXmlContainer::ToNode ( )
pure virtual

The documentation for this class was generated from the following files: