iterator for XML trees More...
#include <xmlstorage.h>
Public Member Functions | |
const_XMLPos (const XMLNode *root) | |
const_XMLPos (const const_XMLPos &other) | |
const_XMLPos (const XMLPos &other) | |
const XMLNode & | cur () const |
access to current node | |
operator const XMLNode * () const | |
automatic access to current node | |
const XMLNode * | operator-> () const |
const XMLNode & | operator* () 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, int &cnt) |
iterate to the next matching child | |
bool | go (const XPath &xpath) |
move to the position defined by xpath in XML tree | |
const XS_String & | str () 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 |
iterator for XML trees
Definition at line 2354 of file xmlstorage.h.
XMLStorage::const_XMLPos::const_XMLPos | ( | const XMLNode * | root ) | [inline] |
Definition at line 2356 of file xmlstorage.h.
XMLStorage::const_XMLPos::const_XMLPos | ( | const const_XMLPos & | other ) | [inline] |
Definition at line 2362 of file xmlstorage.h.
XMLStorage::const_XMLPos::const_XMLPos | ( | const XMLPos & | other ) | [inline] |
Definition at line 2368 of file xmlstorage.h.
bool XMLStorage::const_XMLPos::back | ( | ) | [inline] |
go back to previous position
Definition at line 2398 of file xmlstorage.h.
Referenced by Favorites::read().
{ if (!_stack.empty()) { _cur = _stack.top(); _stack.pop(); return true; } else { assert(!_stack.empty()); return false; } }
const XMLNode& XMLStorage::const_XMLPos::cur | ( | ) | const [inline] |
access to current node
Definition at line 2375 of file xmlstorage.h.
References _cur.
{ return *_cur; }
attribute access
Definition at line 2388 of file xmlstorage.h.
References _cur, and XMLStorage::XMLNode::get().
Referenced by XMLStorage::read_option().
{ return _cur->get(attr_name); }
XS_String XMLStorage::const_XMLPos::get | ( | const T & | attr_name ) | const [inline] |
index operator attribute access
Definition at line 2394 of file xmlstorage.h.
References _cur, and XMLStorage::XMLNode::get().
{return _cur->get(attr_name);}
bool XMLStorage::const_XMLPos::go | ( | const XPath & | xpath ) |
move to the position defined by xpath in XML tree
Definition at line 127 of file xmlstorage.cpp.
References XMLStorage::XPath::_absolute, _cur, _root, XMLStorage::XMLNode::find_relative(), and go_to().
{ const XMLNode* node = xpath._absolute? _root: _cur; node = node->find_relative(xpath); if (node) { go_to(node); return true; } else return false; }
bool XMLStorage::const_XMLPos::go_down | ( | ) | [inline] |
go down to first child
Definition at line 2411 of file xmlstorage.h.
References _cur, XMLStorage::XMLNode::get_first_child(), and go_to().
Referenced by Favorites::read().
{ const XMLNode* node = _cur->get_first_child(); if (node) { go_to(node); return true; } else return false; }
bool XMLStorage::const_XMLPos::go_down | ( | const XS_String & | child_name, |
int | n = 0 |
||
) | [inline] |
search for child and go down
Definition at line 2423 of file xmlstorage.h.
References _cur, XMLStorage::XPathElement::const_find(), and go_to().
{ const XMLNode* node = XPathElement(child_name, n).const_find(_cur); if (node) { go_to(node); return true; } else return false; }
void XMLStorage::const_XMLPos::go_to | ( | const XMLNode * | child ) | [inline, protected] |
bool XMLStorage::const_XMLPos::iterate | ( | const XS_String & | child_name, |
int & | cnt | ||
) | [inline] |
iterate to the next matching child
Definition at line 2435 of file xmlstorage.h.
References _cur, XMLStorage::XPathElement::const_find(), and go_to().
{ const XMLNode* node = XPathElement(child_name, cnt).const_find(_cur); if (node) { go_to(node); ++cnt; return true; } else return false; }
XMLStorage::const_XMLPos::operator const XMLNode * | ( | ) | const [inline] |
automatic access to current node
Definition at line 2381 of file xmlstorage.h.
References _cur.
{return _cur;}
const XMLNode& XMLStorage::const_XMLPos::operator* | ( | ) | const [inline] |
const XMLNode* XMLStorage::const_XMLPos::operator-> | ( | ) | const [inline] |
Definition at line 2395 of file xmlstorage.h.
References _cur, and XMLStorage::XMLNode::get().
{return _cur->get(attr_name);}
const XS_String& XMLStorage::const_XMLPos::str | ( | ) | const [inline] |
const XMLNode* XMLStorage::const_XMLPos::_cur [protected] |
Definition at line 2468 of file xmlstorage.h.
Referenced by back(), cur(), get(), go(), go_down(), go_to(), iterate(), operator const XMLNode *(), operator*(), operator->(), operator[](), and str().
const XMLNode* XMLStorage::const_XMLPos::_root [protected] |
Definition at line 2467 of file xmlstorage.h.
Referenced by go().
std::stack<const XMLNode*> XMLStorage::const_XMLPos::_stack [protected] |
Definition at line 2469 of file xmlstorage.h.
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |