Public Member Functions | Protected Member Functions | Protected Attributes

XMLStorage::const_XMLPos Struct Reference

iterator for XML trees More...

#include <xmlstorage.h>

Collaboration diagram for XMLStorage::const_XMLPos:
Collaboration graph
[legend]

List of all members.

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, 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_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 2354 of file xmlstorage.h.


Constructor & Destructor Documentation

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

Definition at line 2356 of file xmlstorage.h.

     :  _root(root),
        _cur(root)
    {
    }
XMLStorage::const_XMLPos::const_XMLPos ( const const_XMLPos other ) [inline]

Definition at line 2362 of file xmlstorage.h.

     :  _root(other._root),
        _cur(other._cur)
    {   // don't copy _stack
    }
XMLStorage::const_XMLPos::const_XMLPos ( const XMLPos other ) [inline]

Definition at line 2368 of file xmlstorage.h.

     :  _root(other._root),
        _cur(other._cur)
    {   // don't copy _stack
    }

Member Function Documentation

bool XMLStorage::const_XMLPos::back (  ) [inline]

go back to previous position

Definition at line 2398 of file xmlstorage.h.

References _cur, and _stack.

Referenced by Favorites::read().

    {
        if (!_stack.empty()) {
            _cur = _stack.top();
            _stack.pop();
            return true;
        } else {
            assert(!_stack.empty());
            return false;
        }
    }

Here is the caller graph for this function:

const XMLNode& XMLStorage::const_XMLPos::cur (  ) const [inline]

access to current node

Definition at line 2375 of file xmlstorage.h.

References _cur.

    {
        return *_cur;
    }
XS_String XMLStorage::const_XMLPos::get ( const XS_String attr_name ) const [inline]

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);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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);}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:

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;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

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;
    }

Here is the call graph for this function:

void XMLStorage::const_XMLPos::go_to ( const XMLNode child ) [inline, protected]

go to specified node

Definition at line 2472 of file xmlstorage.h.

References _cur, and _stack.

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

    {
        _stack.push(_cur);
        _cur = child;
    }

Here is the caller graph for this function:

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;
    }

Here is the call graph for this function:

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]

Definition at line 2385 of file xmlstorage.h.

References _cur.

{return *_cur;}
const XMLNode* XMLStorage::const_XMLPos::operator-> (  ) const [inline]

Definition at line 2383 of file xmlstorage.h.

References _cur.

{return _cur;}
XS_String XMLStorage::const_XMLPos::operator[] ( const XS_String attr_name ) const [inline]

Definition at line 2395 of file xmlstorage.h.

References _cur, and XMLStorage::XMLNode::get().

{return _cur->get(attr_name);}

Here is the call graph for this function:

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

Definition at line 2464 of file xmlstorage.h.

References _cur.

{return *_cur;}

Member Data Documentation

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.

Referenced by back(), and go_to().


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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage