ReactOS 0.4.15-dev-8076-g06e89b2
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
 
 operator const XMLNode * () const
 automatic access to current node
 
const XMLNodeoperator-> () const
 
const XMLNodeoperator* () const
 
XS_String get (const XS_String &attr_name) const
 attribute access
 
template<typename T >
XS_String get (const T &attr_name) const
 index operator attribute access
 
XS_String operator[] (const XS_String &attr_name) const
 
bool back ()
 go back to previous position
 
bool go_down ()
 go down to first child
 
bool go_down (const XS_String &child_name, int n=0)
 search for child and go down
 
bool iterate (const XS_String &child_name, size_t &cnt)
 iterate to the next matching child
 
bool go (const XPath &xpath)
 move to the position defined by xpath in XML tree
 
const XS_Stringstr () const
 

Protected Member Functions

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

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

◆ const_XMLPos() [1/3]

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 * _root
Definition: xmlstorage.h:1906
const XMLNode * _cur
Definition: xmlstorage.h:1907

◆ const_XMLPos() [2/3]

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 }
int other
Definition: msacm.c:1376

◆ const_XMLPos() [3/3]

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 }

Member Function Documentation

◆ back()

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 }
std::stack< const XMLNode * > _stack
Definition: xmlstorage.h:1908

◆ cur()

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 }

◆ get() [1/2]

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);}
XS_String get(const T &attr_name, LPCXSSTR def=XS_EMPTY_STR) const
read only access to an attribute
Definition: xmlstorage.h:1095

◆ get() [2/2]

XS_String XMLStorage::const_XMLPos::get ( const XS_String attr_name) const
inline

attribute access

Definition at line 1829 of file xmlstorage.h.

1830 {
1831 return _cur->get(attr_name);
1832 }

Referenced by XMLStorage::read_option().

◆ go()

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}
void go_to(const XMLNode *child)
go to specified node
Definition: xmlstorage.h:1911
Definition: dlist.c:348

◆ go_down() [1/2]

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 }
XMLNode * get_first_child() const
Definition: xmlstorage.h:1261

◆ go_down() [2/2]

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 }
GLdouble n
Definition: glext.h:7729

◆ go_to()

void XMLStorage::const_XMLPos::go_to ( const XMLNode child)
inlineprotected

go to specified node

Definition at line 1911 of file xmlstorage.h.

1912 {
1913 _stack.push(_cur);
1914 _cur = child;
1915 }
static HWND child
Definition: cursoricon.c:298

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

◆ iterate()

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 }

◆ operator const XMLNode *()

XMLStorage::const_XMLPos::operator const XMLNode * ( ) const
inline

automatic access to current node

Definition at line 1822 of file xmlstorage.h.

1822{return _cur;}

◆ operator*()

const XMLNode & XMLStorage::const_XMLPos::operator* ( ) const
inline

Definition at line 1826 of file xmlstorage.h.

1826{return *_cur;}

◆ operator->()

const XMLNode * XMLStorage::const_XMLPos::operator-> ( ) const
inline

Definition at line 1824 of file xmlstorage.h.

1824{return _cur;}

◆ operator[]()

XS_String XMLStorage::const_XMLPos::operator[] ( const XS_String attr_name) const
inline

Definition at line 1836 of file xmlstorage.h.

1836{return _cur->get(attr_name);}

◆ str()

const XS_String & XMLStorage::const_XMLPos::str ( ) const
inline

Definition at line 1903 of file xmlstorage.h.

1903{return *_cur;}

Member Data Documentation

◆ _cur

const XMLNode* XMLStorage::const_XMLPos::_cur
protected

◆ _root

const XMLNode* XMLStorage::const_XMLPos::_root
protected

Definition at line 1906 of file xmlstorage.h.

Referenced by go().

◆ _stack

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: