PixelLightAPI
.
|
XML (Extensible Markup Language) document node. More...
#include <XmlDocument.h>
Public Member Functions | |
PLCORE_API | XmlDocument () |
Default constructor. | |
PLCORE_API | XmlDocument (const String &sName) |
Constructor. | |
PLCORE_API | XmlDocument (const XmlDocument &cSource) |
Copy constructor. | |
virtual PLCORE_API | ~XmlDocument () |
Destructor. | |
PLCORE_API XmlDocument & | operator= (const XmlDocument &cSource) |
Copy operator. | |
bool | Load (EEncoding nEncoding=EncodingUnknown) |
Load a file using the current document value. | |
PLCORE_API bool | Load (const String &sFilename, EEncoding nEncoding=EncodingUnknown) |
Load a file using the given filename. | |
PLCORE_API bool | Load (File &cFile, EEncoding nEncoding=EncodingUnknown) |
Loads from a given file. | |
bool | Save () |
Save a file using the current document value. | |
PLCORE_API bool | Save (const String &sFilename) |
Save a file using the given filename. | |
XmlElement * | GetRootElement () |
Get the root element -- the only top level element -- of the document. | |
const XmlElement * | GetRootElement () const |
bool | Error () const |
If an error occurs, error will be set to true. | |
PLCORE_API String | GetErrorDesc (bool bLocation=true) const |
Contains a textual (english) description of the error if one occurs. | |
int | GetErrorID () const |
Generally, you probably want the error string ('GetErrorDesc()') - but if you prefer the error ID, this function will fetch it. | |
int | GetErrorRow () const |
Returns the location (if known) of the error. | |
int | GetErrorColumn () const |
The column where the error occurred. | |
uint32 | GetTabSize () const |
Returns the tab size. | |
void | SetTabSize (uint32 nTabSize=4) |
Sets the tab size. | |
PLCORE_API void | ClearError () |
If you have handled the error, it can be reset with this call. | |
virtual PLCORE_API bool | Save (File &cFile, uint32 nDepth=0) override |
Save function. | |
virtual PLCORE_API String | ToString (uint32 nDepth=0) const override |
Output as string function. | |
virtual PLCORE_API const char * | Parse (const char *pszData, XmlParsingData *pData=nullptr, EEncoding nEncoding=EncodingUnknown) override |
Parse the given null terminated block of XML data. | |
virtual PLCORE_API XmlNode * | Clone () const override |
Create an exact duplicate of this node and return it. |
XML (Extensible Markup Language) document node.
The XML DOM parser is basing on TinyXML (http://www.sourceforge.net/projects/tinyxml).
PLCORE_API PLCore::XmlDocument::XmlDocument | ( | ) |
Default constructor.
PLCORE_API PLCore::XmlDocument::XmlDocument | ( | const String & | sName | ) |
[in] | sName | Document name. The name of the document is also the filename of the XML. |
PLCORE_API PLCore::XmlDocument::XmlDocument | ( | const XmlDocument & | cSource | ) |
Copy constructor.
[in] | cSource | Source to copy from |
virtual PLCORE_API PLCore::XmlDocument::~XmlDocument | ( | ) | [virtual] |
Destructor.
PLCORE_API XmlDocument& PLCore::XmlDocument::operator= | ( | const XmlDocument & | cSource | ) |
Copy operator.
[in] | cSource | Source to copy from |
bool PLCore::XmlDocument::Load | ( | EEncoding | nEncoding = EncodingUnknown | ) | [inline] |
Load a file using the current document value.
[in] | nEncoding | Encoding |
PLCORE_API bool PLCore::XmlDocument::Load | ( | const String & | sFilename, |
EEncoding | nEncoding = EncodingUnknown |
||
) |
Load a file using the given filename.
[in] | sFilename | Filename |
[in] | nEncoding | Encoding |
PLCORE_API bool PLCore::XmlDocument::Load | ( | File & | cFile, |
EEncoding | nEncoding = EncodingUnknown |
||
) |
Loads from a given file.
[in] | cFile | File to read from, must be opened and readable |
[in] | nEncoding | Encoding |
bool PLCore::XmlDocument::Save | ( | ) | [inline] |
Save a file using the current document value.
PLCORE_API bool PLCore::XmlDocument::Save | ( | const String & | sFilename | ) |
Save a file using the given filename.
[in] | sFilename | Filename |
XmlElement * PLCore::XmlDocument::GetRootElement | ( | ) | [inline] |
Get the root element -- the only top level element -- of the document.
const XmlElement * PLCore::XmlDocument::GetRootElement | ( | ) | const [inline] |
bool PLCore::XmlDocument::Error | ( | ) | const [inline] |
If an error occurs, error will be set to true.
PLCORE_API String PLCore::XmlDocument::GetErrorDesc | ( | bool | bLocation = true | ) | const |
Contains a textual (english) description of the error if one occurs.
[in] | bLocation | Do also add the location (if known) of the error? |
int PLCore::XmlDocument::GetErrorID | ( | ) | const [inline] |
Generally, you probably want the error string ('GetErrorDesc()') - but if you prefer the error ID, this function will fetch it.
int PLCore::XmlDocument::GetErrorRow | ( | ) | const [inline] |
Returns the location (if known) of the error.
int PLCore::XmlDocument::GetErrorColumn | ( | ) | const [inline] |
uint32 PLCore::XmlDocument::GetTabSize | ( | ) | const [inline] |
Returns the tab size.
void PLCore::XmlDocument::SetTabSize | ( | uint32 | nTabSize = 4 | ) | [inline] |
Sets the tab size.
[in] | nTabSize | New tab size |
* XmlDocument cDocument; * cDocument.SetTabSize(8); * cDocument.Load("myfile.xml"); *
PLCORE_API void PLCore::XmlDocument::ClearError | ( | ) |
If you have handled the error, it can be reset with this call.
virtual PLCORE_API bool PLCore::XmlDocument::Save | ( | File & | cFile, |
uint32 | nDepth = 0 |
||
) | [override, virtual] |
Save function.
[out] | cFile | File to write in, must be opened and writable |
[in] | nDepth | Current depth |
Implements PLCore::XmlBase.
virtual PLCORE_API String PLCore::XmlDocument::ToString | ( | uint32 | nDepth = 0 | ) | const [override, virtual] |
Output as string function.
[in] | nDepth | Current depth |
Implements PLCore::XmlBase.
virtual PLCORE_API const char* PLCore::XmlDocument::Parse | ( | const char * | pszData, |
XmlParsingData * | pData = nullptr , |
||
EEncoding | nEncoding = EncodingUnknown |
||
) | [override, virtual] |
Parse the given null terminated block of XML data.
[in] | pszData | Parsing data, if a null pointer, an error will be returned |
[in] | pData | Parsing data, can be a null pointer |
[in] | nEncoding | Encoding |
Implements PLCore::XmlBase.
virtual PLCORE_API XmlNode* PLCore::XmlDocument::Clone | ( | ) | const [override, virtual] |
Create an exact duplicate of this node and return it.
Implements PLCore::XmlNode.
|