#include <fsXmlDoc.h>
Collaboration diagram for fs::ut::XmlDoc_t:
The class wraps TinyXml. Furthermore XmlDoc_t offers very simple and powerful string-based query requests for obtaining data from the underlying XML document. A query is formed according to the following rules: '^
' defines the active traversation branch, '#
' counts children elements with the given name, '@
' obtains a value of element's attribute. For example 'disk/folder^2/file^5/@size
' obtains a value of the size attribute of the 6-th file in the 3-rd folder on the disk. For more details see the example.
Definition at line 36 of file fsXmlDoc.h.
Public Member Functions | |
XmlDoc_t (const char *pszFile) | |
Loads the XML document using the given filename. | |
XmlDoc_t (const char *pszData, bool bUnused) | |
Parses the XML document using the given string data. | |
~XmlDoc_t () | |
Unloads the XML document. | |
bool | IsValid () const |
Checks the internal state / correct construction. | |
bool | Query (const char *pszQuery, int &nValue) const |
Queries the XML document, obtains an int result. | |
bool | Query (const char *pszQuery, const char *&pszText) const |
Queries the XML document, obtains a string result. | |
Private Member Functions | |
XmlDoc_t () | |
No def ctor. | |
XmlDoc_t (const XmlDoc_t &) | |
No copy. | |
XmlDoc_t & | operator= (const XmlDoc_t &) |
No assignment. | |
Private Attributes | |
void * | m_pImpl |
The PIPML idiom is used. |
XmlDoc_t::XmlDoc_t | ( | const char * | pszFile | ) | [explicit] |
Loads the XML document using the given filename.
Definition at line 284 of file fsXmlDoc.cpp.
References FS_ASSERT_MSG, and m_pImpl.
XmlDoc_t::XmlDoc_t | ( | const char * | pszData, | |
bool | bUnused | |||
) |
Parses the XML document using the given string data.
Definition at line 290 of file fsXmlDoc.cpp.
References FS_ASSERT_MSG, and m_pImpl.
XmlDoc_t::~XmlDoc_t | ( | ) |
Unloads the XML document.
Definition at line 296 of file fsXmlDoc.cpp.
References FS_ASSERT_MSG, and m_pImpl.
fs::ut::XmlDoc_t::XmlDoc_t | ( | ) | [private] |
No def ctor.
fs::ut::XmlDoc_t::XmlDoc_t | ( | const XmlDoc_t & | ) | [private] |
No copy.
bool XmlDoc_t::IsValid | ( | ) | const |
Checks the internal state / correct construction.
Definition at line 302 of file fsXmlDoc.cpp.
References FS_ASSERT_MSG, and m_pImpl.
bool XmlDoc_t::Query | ( | const char * | pszQuery, | |
const char *& | pszText | |||
) | const |
Queries the XML document, obtains a string result.
pszQuery | Query string consisting of a path and a request. | |
pszText | Reference to a variable receiving the resulting text. Note that if the query fail, pszText is not affected. |
Definition at line 324 of file fsXmlDoc.cpp.
References FS_ASSERT_MSG, m_pImpl, and Query().
Here is the call graph for this function:
bool XmlDoc_t::Query | ( | const char * | pszQuery, | |
int & | nValue | |||
) | const |
Queries the XML document, obtains an int result.
pszQuery | Query string consisting of a path and a request. | |
nValue | Reference to a variable receiving the resulting value. Note that if the query fail, nValue is not affected. |
Definition at line 313 of file fsXmlDoc.cpp.
References FS_ASSERT_MSG, and m_pImpl.
void* fs::ut::XmlDoc_t::m_pImpl [private] |