soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SXmlDoc Class Reference

Implementation of IXmlDoc. More...

#include <SXml.h>

Inheritance diagram for SXmlDoc:
TObjRefImpl< IXmlDoc > IXmlDoc IObjRef

Public Member Functions

 SXmlDoc ()
 Constructor for SXmlDoc.
 
 ~SXmlDoc ()
 Destructor for SXmlDoc.
 
LPVOID GetPrivPtr () SCONST OVERRIDE
 Retrieves a private pointer associated with the document.
 
void Reset () OVERRIDE
 Resets the document, removing all nodes.
 
void Copy (const IXmlDoc *proto) OVERRIDE
 Copies the contents of another document into this document.
 
BOOL LoadString (const wchar_t *contents, unsigned int options) OVERRIDE
 Loads the document from a zero-terminated string.
 
BOOL LoadFileA (const char *path, unsigned int options, XmlEncoding encoding) OVERRIDE
 Loads the document from a file (ANSI version).
 
BOOL LoadFileW (const wchar_t *path, unsigned int options, XmlEncoding encoding) OVERRIDE
 Loads the document from a file (Unicode version).
 
BOOL LoadBuffer (const void *contents, size_t size, unsigned int options, XmlEncoding encoding) OVERRIDE
 Loads the document from a buffer.
 
BOOL LoadBufferInplace (void *contents, size_t size, unsigned int options, XmlEncoding encoding) OVERRIDE
 Loads the document from a buffer using in-place parsing.
 
BOOL LoadBufferInplaceOwn (void *contents, size_t size, unsigned int options, XmlEncoding encoding) OVERRIDE
 Loads the document from a buffer using in-place parsing with automatic buffer management.
 
void GetParseResult (XmlParseResult *pResult) SCONST OVERRIDE
 Retrieves the result of the last parsing operation.
 
void SaveBinary (FILE *f) SCONST OVERRIDE
 Saves the XML document to a writer.
 
BOOL SaveFileA (const char *path, const wchar_t *indent, unsigned int flags, XmlEncoding encoding) SCONST OVERRIDE
 Saves the XML document to a file (ANSI version).
 
BOOL SaveFileW (const wchar_t *path, const wchar_t *indent, unsigned int flags, XmlEncoding encoding) SCONST OVERRIDE
 Saves the XML document to a file (Unicode version).
 
IXmlNodeRoot () SCONST OVERRIDE
 Retrieves the root node of the document.
 
bool load_string (const wchar_t *contents, unsigned int options=xml_parse_default)
 Loads the document from a zero-terminated string.
 
bool load_file (const char *path, unsigned int options=xml_parse_default, XmlEncoding encoding=enc_auto)
 Loads the document from a file (ANSI version).
 
bool load_file (const wchar_t *path, unsigned int options=xml_parse_default, XmlEncoding encoding=enc_auto)
 Loads the document from a file (Unicode version).
 
bool load_buffer (const void *contents, size_t size, unsigned int options=xml_parse_default, XmlEncoding encoding=enc_auto)
 Loads the document from a buffer.
 
bool load_buffer_inplace (void *contents, size_t size, unsigned int options=xml_parse_default, XmlEncoding encoding=enc_auto)
 Loads the document from a buffer using in-place parsing.
 
bool load_buffer_inplace_own (void *contents, size_t size, unsigned int options=xml_parse_default, XmlEncoding encoding=enc_auto)
 Loads the document from a buffer using in-place parsing with automatic buffer management.
 
bool save_file (const char *path, const wchar_t *indent=L"\t", unsigned int flags=xml_parse_default, XmlEncoding encoding=enc_auto) const
 Saves the XML document to a file (ANSI version).
 
bool save_file (const wchar_t *path, const wchar_t *indent=L"\t", unsigned int flags=xml_parse_default, XmlEncoding encoding=enc_auto) const
 Saves the XML document to a file (Unicode version).
 
SXmlNode root () const
 Retrieves the root node of the document.
 
- Public Member Functions inherited from TObjRefImpl< IXmlDoc >
 TObjRefImpl ()
 Constructor that initializes the reference count to 1.
 
virtual ~TObjRefImpl ()
 Virtual destructor.
 
long AddRef () override
 Increments the reference count.
 
long Release () override
 Decrements the reference count and deletes the object if the count reaches zero.
 
void OnFinalRelease () override
 Deletes the object.
 
- Public Member Functions inherited from IObjRef
long AddRef () PURE
 Increases the reference count.
 
long Release () PURE
 Decreases the reference count.
 
void OnFinalRelease () PURE
 Called when the reference count reaches zero and the object is about to be released.
 

Static Public Member Functions

static const char * GetErrDesc (XmlStatus status)
 Retrieves the error description for a given XML status.
 

Friends

class SXmlAttr
 
class SXmlNode
 

Additional Inherited Members

- Protected Attributes inherited from TObjRefImpl< IXmlDoc >
LONG m_cRef
 Reference count.
 

Detailed Description

Implementation of IXmlDoc.

Definition at line 911 of file SXml.h.

Constructor & Destructor Documentation

◆ SXmlDoc()

SXmlDoc::SXmlDoc ( )

Constructor for SXmlDoc.

Definition at line 611 of file SXml.cpp.

◆ ~SXmlDoc()

SXmlDoc::~SXmlDoc ( )

Destructor for SXmlDoc.

Definition at line 619 of file SXml.cpp.

Member Function Documentation

◆ Copy()

void SXmlDoc::Copy ( const IXmlDoc * proto)

Copies the contents of another document into this document.

Parameters
protoThe document to copy from.

Implements IXmlDoc.

Definition at line 692 of file SXml.cpp.

◆ GetErrDesc()

const char * SXmlDoc::GetErrDesc ( XmlStatus status)
static

Retrieves the error description for a given XML status.

Parameters
statusThe XML status.
Returns
The error description.

Definition at line 759 of file SXml.cpp.

◆ GetParseResult()

void SXmlDoc::GetParseResult ( XmlParseResult * pResult)

Retrieves the result of the last parsing operation.

Parameters
pResultThe parse result to store.

Implements IXmlDoc.

Definition at line 684 of file SXml.cpp.

◆ GetPrivPtr()

LPVOID SXmlDoc::GetPrivPtr ( )

Retrieves a private pointer associated with the document.

Returns
The private pointer.

Implements IXmlDoc.

Definition at line 703 of file SXml.cpp.

◆ load_buffer()

bool SXmlDoc::load_buffer ( const void * contents,
size_t size,
unsigned int options = xml_parse_default,
XmlEncoding encoding = enc_auto )

Loads the document from a buffer.

Parameters
contentsThe buffer containing the XML data.
sizeThe size of the buffer.
optionsParsing options.
encodingThe encoding of the buffer.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.

Definition at line 726 of file SXml.cpp.

◆ load_buffer_inplace()

bool SXmlDoc::load_buffer_inplace ( void * contents,
size_t size,
unsigned int options = xml_parse_default,
XmlEncoding encoding = enc_auto )

Loads the document from a buffer using in-place parsing.

Parameters
contentsThe buffer containing the XML data.
sizeThe size of the buffer.
optionsParsing options.
encodingThe encoding of the buffer.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.
Note
You should ensure that buffer data will persist throughout the document's lifetime and free the buffer memory manually once the document is destroyed.

Definition at line 732 of file SXml.cpp.

◆ load_buffer_inplace_own()

bool SXmlDoc::load_buffer_inplace_own ( void * contents,
size_t size,
unsigned int options = xml_parse_default,
XmlEncoding encoding = enc_auto )

Loads the document from a buffer using in-place parsing with automatic buffer management.

Parameters
contentsThe buffer containing the XML data.
sizeThe size of the buffer.
optionsParsing options.
encodingThe encoding of the buffer.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.
Note
You should allocate the buffer with pugixml allocation function; document will free the buffer when it is no longer needed.

Definition at line 738 of file SXml.cpp.

◆ load_file() [1/2]

bool SXmlDoc::load_file ( const char * path,
unsigned int options = xml_parse_default,
XmlEncoding encoding = enc_auto )

Loads the document from a file (ANSI version).

Parameters
pathThe path to the file.
optionsParsing options.
encodingThe encoding of the file.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.

Definition at line 714 of file SXml.cpp.

◆ load_file() [2/2]

bool SXmlDoc::load_file ( const wchar_t * path,
unsigned int options = xml_parse_default,
XmlEncoding encoding = enc_auto )

Loads the document from a file (Unicode version).

Parameters
pathThe path to the file.
optionsParsing options.
encodingThe encoding of the file.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.

Definition at line 720 of file SXml.cpp.

◆ load_string()

bool SXmlDoc::load_string ( const wchar_t * contents,
unsigned int options = xml_parse_default )

Loads the document from a zero-terminated string.

Parameters
contentsThe string containing the XML data.
optionsParsing options.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.

Definition at line 708 of file SXml.cpp.

◆ LoadBuffer()

BOOL SXmlDoc::LoadBuffer ( const void * contents,
size_t size,
unsigned int options,
XmlEncoding encoding )

Loads the document from a buffer.

Parameters
contentsThe buffer containing the XML data.
sizeThe size of the buffer.
optionsParsing options.
encodingThe encoding of the buffer.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.

Implements IXmlDoc.

Definition at line 660 of file SXml.cpp.

◆ LoadBufferInplace()

BOOL SXmlDoc::LoadBufferInplace ( void * contents,
size_t size,
unsigned int options,
XmlEncoding encoding )

Loads the document from a buffer using in-place parsing.

Parameters
contentsThe buffer containing the XML data.
sizeThe size of the buffer.
optionsParsing options.
encodingThe encoding of the buffer.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.
Note
You should ensure that buffer data will persist throughout the document's lifetime and free the buffer memory manually once the document is destroyed.

Implements IXmlDoc.

Definition at line 654 of file SXml.cpp.

◆ LoadBufferInplaceOwn()

BOOL SXmlDoc::LoadBufferInplaceOwn ( void * contents,
size_t size,
unsigned int options,
XmlEncoding encoding )

Loads the document from a buffer using in-place parsing with automatic buffer management.

Parameters
contentsThe buffer containing the XML data.
sizeThe size of the buffer.
optionsParsing options.
encodingThe encoding of the buffer.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.
Note
You should allocate the buffer with pugixml allocation function; document will free the buffer when it is no longer needed.

Implements IXmlDoc.

Definition at line 648 of file SXml.cpp.

◆ LoadFileA()

BOOL SXmlDoc::LoadFileA ( const char * path,
unsigned int options,
XmlEncoding encoding )

Loads the document from a file (ANSI version).

Parameters
pathThe path to the file.
optionsParsing options.
encodingThe encoding of the file.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.

Implements IXmlDoc.

Definition at line 672 of file SXml.cpp.

◆ LoadFileW()

BOOL SXmlDoc::LoadFileW ( const wchar_t * path,
unsigned int options,
XmlEncoding encoding )

Loads the document from a file (Unicode version).

Parameters
pathThe path to the file.
optionsParsing options.
encodingThe encoding of the file.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.

Implements IXmlDoc.

Definition at line 666 of file SXml.cpp.

◆ LoadString()

BOOL SXmlDoc::LoadString ( const wchar_t * contents,
unsigned int options )

Loads the document from a zero-terminated string.

Parameters
contentsThe string containing the XML data.
optionsParsing options.
Returns
TRUE if the document was successfully loaded, FALSE otherwise.

Implements IXmlDoc.

Definition at line 678 of file SXml.cpp.

◆ Reset()

void SXmlDoc::Reset ( )

Resets the document, removing all nodes.

Implements IXmlDoc.

Definition at line 697 of file SXml.cpp.

◆ Root()

IXmlNode * SXmlDoc::Root ( )

Retrieves the root node of the document.

Returns
The root node.

Implements IXmlDoc.

Definition at line 627 of file SXml.cpp.

◆ root()

SXmlNode SXmlDoc::root ( ) const

Retrieves the root node of the document.

Returns
The root node.

Definition at line 754 of file SXml.cpp.

◆ save_file() [1/2]

bool SXmlDoc::save_file ( const char * path,
const wchar_t * indent = L"\t",
unsigned int flags = xml_parse_default,
XmlEncoding encoding = enc_auto ) const

Saves the XML document to a file (ANSI version).

Parameters
pathThe path to the file.
indentThe indentation string.
flagsSaving flags.
encodingThe encoding of the file.
Returns
TRUE if the document was successfully saved, FALSE otherwise.

Definition at line 744 of file SXml.cpp.

◆ save_file() [2/2]

bool SXmlDoc::save_file ( const wchar_t * path,
const wchar_t * indent = L"\t",
unsigned int flags = xml_parse_default,
XmlEncoding encoding = enc_auto ) const

Saves the XML document to a file (Unicode version).

Parameters
pathThe path to the file.
indentThe indentation string.
flagsSaving flags.
encodingThe encoding of the file.
Returns
TRUE if the document was successfully saved, FALSE otherwise.

Definition at line 749 of file SXml.cpp.

◆ SaveBinary()

void SXmlDoc::SaveBinary ( FILE * f)

Saves the XML document to a writer.

Parameters
fThe file pointer to write to.
Note
Semantics is slightly different from xml_node::print, see documentation for details.

Implements IXmlDoc.

Definition at line 643 of file SXml.cpp.

◆ SaveFileA()

BOOL SXmlDoc::SaveFileA ( const char * path,
const wchar_t * indent,
unsigned int flags,
XmlEncoding encoding )

Saves the XML document to a file (ANSI version).

Parameters
pathThe path to the file.
indentThe indentation string.
flagsSaving flags.
encodingThe encoding of the file.
Returns
TRUE if the document was successfully saved, FALSE otherwise.

Implements IXmlDoc.

Definition at line 637 of file SXml.cpp.

◆ SaveFileW()

BOOL SXmlDoc::SaveFileW ( const wchar_t * path,
const wchar_t * indent,
unsigned int flags,
XmlEncoding encoding )

Saves the XML document to a file (Unicode version).

Parameters
pathThe path to the file.
indentThe indentation string.
flagsSaving flags.
encodingThe encoding of the file.
Returns
TRUE if the document was successfully saved, FALSE otherwise.

Implements IXmlDoc.

Definition at line 632 of file SXml.cpp.

Friends And Related Symbol Documentation

◆ SXmlAttr

friend class SXmlAttr
friend

Definition at line 913 of file SXml.h.

◆ SXmlNode

friend class SXmlNode
friend

Definition at line 914 of file SXml.h.


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