ReactOS  r76032
XMLStorage::const_XMLPos Struct Reference

iterator for XML trees More...

#include <xmlstorage.h>

Collaboration diagram for XMLStorage::const_XMLPos:

Public Member Functions

 const_XMLPos (const XMLNode *root)
 
 const_XMLPos (const const_XMLPos &other)
 
 const_XMLPos (const XMLPos &other)
 
const XMLNodecur () const
 access to current node More...
 
 operator const XMLNode * () const
 automatic access to current node More...
 
const XMLNodeoperator-> () const
 
const XMLNodeoperator* () const
 
XS_String get (const XS_String &attr_name) const
 attribute access More...
 
template<typename T >
XS_String get (const T &attr_name) const
 index operator attribute access More...
 
XS_String operator[] (const XS_String &attr_name) const
 
bool back ()
 go back to previous position More...
 
bool go_down ()
 go down to first child More...
 
bool go_down (const XS_String &child_name, int n=0)
 search for child and go down More...
 
bool iterate (const XS_String &child_name, size_t &cnt)
 iterate to the next matching child More...
 
bool go (const XPath &xpath)
 move to the position defined by xpath in XML tree More...
 
const XS_Stringstr () const
 

Protected Member Functions

void go_to (const XMLNode *child)
 go to specified node More...
 

Protected Attributes

const XMLNode_root
 
const XMLNode_cur
 
std::stack< const XMLNode * > _stack
 

Detailed Description

iterator for XML trees

Definition at line 1795 of file xmlstorage.h.

Constructor & Destructor Documentation

XMLStorage::const_XMLPos::const_XMLPos ( const XMLNode root)
inline

Definition at line 1797 of file xmlstorage.h.

1798  : _root(root),
1799  _cur(root)
1800  {
1801  }
const XMLNode * _cur
Definition: xmlstorage.h:1907
const XMLNode * _root
Definition: xmlstorage.h:1906
XMLStorage::const_XMLPos::const_XMLPos ( const const_XMLPos other)
inline

Definition at line 1803 of file xmlstorage.h.

1804  : _root(other._root),
1805  _cur(other._cur)
1806  { // don't copy _stack
1807  }
const XMLNode * _cur
Definition: xmlstorage.h:1907
int other
Definition: msacm.c:1364
const XMLNode * _root
Definition: xmlstorage.h:1906
XMLStorage::const_XMLPos::const_XMLPos ( const XMLPos other)
inline

Definition at line 1809 of file xmlstorage.h.

1810  : _root(other._root),
1811  _cur(other._cur)
1812  { // don't copy _stack
1813  }
const XMLNode * _cur
Definition: xmlstorage.h:1907
int other
Definition: msacm.c:1364
const XMLNode * _root
Definition: xmlstorage.h:1906

Member Function Documentation

bool XMLStorage::const_XMLPos::back ( )
inline

go back to previous position

Definition at line 1839 of file xmlstorage.h.

1840  {
1841  if (!_stack.empty()) {
1842  _cur = _stack.top();
1843  _stack.pop();
1844  return true;
1845  } else
1846  return false;
1847  }
const XMLNode * _cur
Definition: xmlstorage.h:1907
std::stack< const XMLNode * > _stack
Definition: xmlstorage.h:1908
const XMLNode& XMLStorage::const_XMLPos::cur ( ) const
inline

access to current node

Definition at line 1816 of file xmlstorage.h.

1817  {
1818  return *_cur;
1819  }
const XMLNode * _cur
Definition: xmlstorage.h:1907
XS_String XMLStorage::const_XMLPos::get ( const XS_String attr_name) const
inline

attribute access

Definition at line 1829 of file xmlstorage.h.

Referenced by XMLStorage::read_option().

1830  {
1831  return _cur->get(attr_name);
1832  }
const XMLNode * _cur
Definition: xmlstorage.h:1907
XS_String get(const T &attr_name, LPCXSSTR def=XS_EMPTY_STR) const
read only access to an attribute
Definition: xmlstorage.h:1095
template<typename T >
XS_String XMLStorage::const_XMLPos::get ( const T attr_name) const
inline

index operator attribute access

Definition at line 1835 of file xmlstorage.h.

1835 {return _cur->get(attr_name);}
const XMLNode * _cur
Definition: xmlstorage.h:1907
XS_String get(const T &attr_name, LPCXSSTR def=XS_EMPTY_STR) const
read only access to an attribute
Definition: xmlstorage.h:1095
bool XMLStorage::const_XMLPos::go ( const XPath xpath)

move to the position defined by xpath in XML tree

Definition at line 128 of file xmlstorage.cpp.

129 {
130  const XMLNode* node = xpath._absolute? _root: _cur;
131 
132  node = node->find_relative(xpath);
133 
134  if (node) {
135  go_to(node);
136  return true;
137  } else
138  return false;
139 }
Definition: graphics.c:176
const XMLNode * _cur
Definition: xmlstorage.h:1907
void go_to(const XMLNode *child)
go to specified node
Definition: xmlstorage.h:1911
const XMLNode * find_relative(const XPath &xpath) const
XPath find function (const)
Definition: xmlstorage.cpp:251
bool XMLStorage::const_XMLPos::go_down ( )
inline

go down to first child

Definition at line 1850 of file xmlstorage.h.

1851  {
1852  const XMLNode* node = _cur->get_first_child();
1853 
1854  if (node) {
1855  go_to(node);
1856  return true;
1857  } else
1858  return false;
1859  }
Definition: graphics.c:176
const XMLNode * _cur
Definition: xmlstorage.h:1907
void go_to(const XMLNode *child)
go to specified node
Definition: xmlstorage.h:1911
XMLNode * get_first_child() const
Definition: xmlstorage.h:1261
bool XMLStorage::const_XMLPos::go_down ( const XS_String child_name,
int  n = 0 
)
inline

search for child and go down

Definition at line 1862 of file xmlstorage.h.

1863  {
1864  const XMLNode* node = XPathElement(child_name, n).const_find(_cur);
1865 
1866  if (node) {
1867  go_to(node);
1868  return true;
1869  } else
1870  return false;
1871  }
Definition: graphics.c:176
const XMLNode * _cur
Definition: xmlstorage.h:1907
GLuint n
Definition: s_context.h:57
void go_to(const XMLNode *child)
go to specified node
Definition: xmlstorage.h:1911
void XMLStorage::const_XMLPos::go_to ( const XMLNode child)
inlineprotected

go to specified node

Definition at line 1911 of file xmlstorage.h.

Referenced by go(), go_down(), and iterate().

1912  {
1913  _stack.push(_cur);
1914  _cur = child;
1915  }
const XMLNode * _cur
Definition: xmlstorage.h:1907
std::stack< const XMLNode * > _stack
Definition: xmlstorage.h:1908
static HWND child
Definition: cursoricon.c:298
bool XMLStorage::const_XMLPos::iterate ( const XS_String child_name,
size_t cnt 
)
inline

iterate to the next matching child

Definition at line 1874 of file xmlstorage.h.

1875  {
1876  const XMLNode* node = XPathElement(child_name, cnt).const_find(_cur);
1877 
1878  if (node) {
1879  go_to(node);
1880  ++cnt;
1881  return true;
1882  } else
1883  return false;
1884  }
Definition: graphics.c:176
const XMLNode * _cur
Definition: xmlstorage.h:1907
void go_to(const XMLNode *child)
go to specified node
Definition: xmlstorage.h:1911

automatic access to current node

Definition at line 1822 of file xmlstorage.h.

1822 {return _cur;}
const XMLNode * _cur
Definition: xmlstorage.h:1907

Definition at line 1826 of file xmlstorage.h.

1826 {return *_cur;}
const XMLNode * _cur
Definition: xmlstorage.h:1907

Definition at line 1824 of file xmlstorage.h.

1824 {return _cur;}
const XMLNode * _cur
Definition: xmlstorage.h:1907

Definition at line 1836 of file xmlstorage.h.

1836 {return _cur->get(attr_name);}
const XMLNode * _cur
Definition: xmlstorage.h:1907
XS_String get(const T &attr_name, LPCXSSTR def=XS_EMPTY_STR) const
read only access to an attribute
Definition: xmlstorage.h:1095
const XS_String& XMLStorage::const_XMLPos::str ( ) const
inline

Definition at line 1903 of file xmlstorage.h.

1903 {return *_cur;}
const XMLNode * _cur
Definition: xmlstorage.h:1907

Member Data Documentation

const XMLNode* XMLStorage::const_XMLPos::_cur
protected
const XMLNode* XMLStorage::const_XMLPos::_root
protected

Definition at line 1906 of file xmlstorage.h.

std::stack<const XMLNode*> XMLStorage::const_XMLPos::_stack
protected

Definition at line 1908 of file xmlstorage.h.

Referenced by back(), and go_to().


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