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

#include <cXmlDocument.h>

Inheritance diagram for GrayLib::cXmlDocument:
GrayLib::cXmlNode GrayLib::cXmlContainer Gray::cListNodeT< cXmlNode > GrayLib::cXml Gray::cNonCopyable Gray::cListT< cXmlNode > GrayLib::cXml Gray::cListNodeBase Gray::cListBase Gray::cHeapObject Gray::IHeapObject

Public Member Functions

 cXmlDocument ()
 Create a document with a name. The name of the document is also the filename of the XML. More...
 
 cXmlDocument (const cXmlDocument &rCopy)
 
virtual ~cXmlDocument ()
 
void operator= (const cXmlDocument &rCopy)
 
HRESULT LoadFile (cStreamInput &stmIn)
 
HRESULT LoadFile (const FILECHAR_t *pszFilename)
 Load a file using the given filename. Returns true if successful. More...
 
HRESULT SaveFile (cStreamOutput &rOut) const
 Save a file using the given cStreamOutput*. Returns true if successful. More...
 
HRESULT SaveFile (const FILECHAR_t *pszFilename) const
 Save a file using the given filename. Returns true if successful. More...
 
virtual void SetClear ()
 Delete all the children of this node. Does not affect 'this'. More...
 
virtual cXmlContainerToContainer ()
 
virtual cXmlNodeToNode ()
 cast cXmlContainer is a cXmlDocument or cXmlElement More...
 
virtual cXmlNodeClone () const
 [internal use] More...
 
virtual HRESULT SetParseNode (cXmlReader &rReader)
 
virtual HRESULT Print (cStreamOutput &rOut, int nDepth=0) const
 Print this Document to a cStreamOutput stream. More...
 
virtual bool OnVisit (IXmlVisitor *content) const
 Walk the XML tree visiting this node and all of its children. More...
 
virtual cXmlDocumentToDocument ()
 
virtual const cXmlDocumentToDocument () const
 
- Public Member Functions inherited from GrayLib::cXmlNode
virtual ~cXmlNode ()
 
XMLNODE_TYPE get_Type () const
 
bool isType (XMLNODE_TYPE eType) const
 
void put_UserData (void *pUserData)
 
void * get_UserData () const
 
void put_Value (cXmlString sValue)
 
const cXmlStringget_Value () const
 
HRESULT QueryValueInt (int *piValue) const
 
HRESULT QueryValueDouble (double *pdValue) const
 QueryValueDouble examines the value string. See QueryValueInt(). More...
 
int get_ValueInt () const
 Return the value of this attribute, converted to an integer. More...
 
double get_ValueDouble () const
 Return the value of this attribute, converted to a double. More...
 
void put_ValueInt (int iValue)
 Set the value from an integer. More...
 
void put_ValueDouble (double dValue)
 Set the value from a double. More...
 
cXmlDocumentget_Document () const
 
cXmlNodeGetPreviousSibling (const char *pszValue) const
 Navigate to a sibling node. More...
 
cXmlNodeGetNextSiblingX (const char *pszValue) const
 Navigate to a sibling node with the given 'value'. More...
 
cXmlElementget_NextSiblingElement () const
 
cXmlElementGetNextSiblingElement (const char *pszValue) const
 
HRESULT SetParse (const char *pszData, CXML_ENCODING_TYPE eEncoding=CXML_ENCODING_UNKNOWN)
 
ITERATE_t get_Row () const
 
StrLen_t get_Column () const
 
- Public Member Functions inherited from Gray::cListNodeT< cXmlNode >
cXmlNode * get_Next () const
 
cXmlNode * get_Prev () const
 
- Public Member Functions inherited from Gray::cListNodeBase
virtual ~cListNodeBase ()
 
cListBaseget_Parent () const noexcept
 
cListNodeBaseget_Next () const noexcept
 
cListNodeBaseget_Prev () const noexcept
 
bool hasParent () const noexcept
 
void RemoveFromParent ()
 
virtual HRESULT DisposeThis ()
 
- Public Member Functions inherited from Gray::cHeapObject
 cHeapObject ()
 
virtual ~cHeapObject ()
 
bool IsValidInsideN (INT_PTR index) const
 
bool IsValidInsidePtr (void const *pTest) const
 
virtual size_t GetHeapStatsThis (OUT ITERATE_t &iAllocCount) const
 
virtual bool isValidCheck () const noexcept
 
- Public Member Functions inherited from GrayLib::cXmlContainer
virtual ~cXmlContainer ()
 
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::cXmlNode
static HRESULT PrintDepth (cStreamOutput &rOut, int nDepth)
 
- 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)
 
- Public Attributes inherited from GrayLib::cXmlNode
cTextPos m_Pos
 Where (line,col) in the parsed XML document is this node? m_PosNode. More...
 
- 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 GrayLib::cXmlNode
 cXmlNode (XMLNODE_TYPE eNodeType, cXmlString sValue="")
 Only instantiate as a derived type. More...
 
virtual void SetCopy (const cXmlNode &n)
 
- Protected Member Functions inherited from Gray::cListNodeBase
virtual void put_Parent (cListBase *pParent)
 
 cListNodeBase () noexcept
 
- Protected Member Functions inherited from Gray::cHeapObject
const void * get_HeapPtr () const noexcept override
 Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr(). More...
 
- Protected Member Functions inherited from Gray::cNonCopyable
 cNonCopyable () noexcept
 Force the use of Factory creation via protected constructor. More...
 
 ~cNonCopyable () noexcept
 
- 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 GrayLib::cXmlNode
const XMLNODE_TYPE m_eNodeType
 
cXmlString m_sValue
 parent usage dependent m_eNodeType. More...
 
void * m_pUserData
 Field containing a generic pointer to arbitrary user data. 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

XMLNODE_Document = holds a DOM for all data in XML. Always the top level node. A document binds together all the XML pieces. It can be saved, loaded, and printed to the screen. The 'value' of a document node is the XML file name.

Constructor & Destructor Documentation

◆ cXmlDocument() [1/2]

GrayLib::cXmlDocument::cXmlDocument ( )

Create a document with a name. The name of the document is also the filename of the XML.

◆ cXmlDocument() [2/2]

GrayLib::cXmlDocument::cXmlDocument ( const cXmlDocument rCopy)

◆ ~cXmlDocument()

virtual GrayLib::cXmlDocument::~cXmlDocument ( )
inlinevirtual

Member Function Documentation

◆ Clone()

cXmlNode * GrayLib::cXmlDocument::Clone ( ) const
virtual

[internal use]

Implements GrayLib::cXmlNode.

◆ LoadFile() [1/2]

HRESULT GrayLib::cXmlDocument::LoadFile ( const FILECHAR_t pszFilename)

Load a file using the given filename. Returns true if successful.

◆ LoadFile() [2/2]

HRESULT GrayLib::cXmlDocument::LoadFile ( cStreamInput stmIn)

Load a file using the given cStreamOutput*. Returns true if successful. Note that this method doesn't stream - the entire object pointed at by the cStreamOutput* will be interpreted as an XML file. cXml doesn't stream in XML from the current file location. Streaming may be added in the future.

Populate cXmlDocument node/doc.

◆ OnVisit()

bool GrayLib::cXmlDocument::OnVisit ( IXmlVisitor content) const
virtual

Walk the XML tree visiting this node and all of its children.

Implements GrayLib::cXmlNode.

◆ operator=()

void GrayLib::cXmlDocument::operator= ( const cXmlDocument rCopy)
inline

◆ Print()

HRESULT GrayLib::cXmlDocument::Print ( cStreamOutput rOut,
int  nDepth = 0 
) const
virtual

Print this Document to a cStreamOutput stream.

Implements GrayLib::cXmlNode.

◆ SaveFile() [1/2]

HRESULT GrayLib::cXmlDocument::SaveFile ( const FILECHAR_t pszFilename) const

Save a file using the given filename. Returns true if successful.

◆ SaveFile() [2/2]

HRESULT GrayLib::cXmlDocument::SaveFile ( cStreamOutput rOut) const

Save a file using the given cStreamOutput*. Returns true if successful.

◆ SetClear()

void GrayLib::cXmlDocument::SetClear ( )
virtual

Delete all the children of this node. Does not affect 'this'.

Reimplemented from GrayLib::cXmlNode.

◆ SetParseNode()

HRESULT GrayLib::cXmlDocument::SetParseNode ( cXmlReader rReader)
virtual

Parse the given null terminated block of XML data. Passing in an eEncoding to this method (either CXML_ENCODING_LEGACY or CXML_ENCODING_UTF8 will force cXml to use that encoding, regardless of what cXml might otherwise try to detect.

Parse/populate XMLNODE_Document Parse at the document level. Since a document contains nothing but other tags, most of what happens here is skipping white space.

Implements GrayLib::cXmlNode.

◆ ToContainer()

virtual cXmlContainer* GrayLib::cXmlDocument::ToContainer ( )
inlinevirtual

Reimplemented from GrayLib::cXmlNode.

◆ ToDocument() [1/2]

virtual cXmlDocument* GrayLib::cXmlDocument::ToDocument ( )
inlinevirtual

◆ ToDocument() [2/2]

virtual const cXmlDocument* GrayLib::cXmlDocument::ToDocument ( ) const
inlinevirtual

◆ ToNode()

virtual cXmlNode* GrayLib::cXmlDocument::ToNode ( )
inlinevirtual

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