fs::ut::XmlDoc_t Class Reference

#include <fsXmlDoc.h>

Collaboration diagram for fs::ut::XmlDoc_t:

Collaboration graph
[legend]
List of all members.

Detailed Description

Simple TinyXml wrapper.

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.

Examples:

_tests/fsXmlDoc/main.cpp.

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_toperator= (const XmlDoc_t &)
 No assignment.

Private Attributes

void * m_pImpl
 The PIPML idiom is used.


Constructor & Destructor Documentation

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.


Member Function Documentation

bool XmlDoc_t::IsValid (  )  const

Checks the internal state / correct construction.

Examples:
_tests/fsXmlDoc/main.cpp.

Definition at line 302 of file fsXmlDoc.cpp.

References FS_ASSERT_MSG, and m_pImpl.

XmlDoc_t& fs::ut::XmlDoc_t::operator= ( const XmlDoc_t  )  [private]

No assignment.

bool XmlDoc_t::Query ( const char *  pszQuery,
const char *&  pszText 
) const

Queries the XML document, obtains a string result.

Parameters:
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.
Returns:
true indicates success.

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.

Parameters:
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.
Returns:
true indicates success.
Examples:
_tests/fsXmlDoc/main.cpp.

Definition at line 313 of file fsXmlDoc.cpp.

References FS_ASSERT_MSG, and m_pImpl.


Member Data Documentation

void* fs::ut::XmlDoc_t::m_pImpl [private]

The PIPML idiom is used.

Definition at line 60 of file fsXmlDoc.h.


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

FipS' Code (Thu Feb 15 22:43:56 2007) - (c) Filip STOKLAS (FipS) - [ www ] [ Guest Book ]