Classes | Public Types | Public Member Functions

XMLStorage::XS_StringMap Struct Reference

#include <xmlstorage.h>

Inheritance diagram for XMLStorage::XS_StringMap:
Inheritance graph
[legend]
Collaboration diagram for XMLStorage::XS_StringMap:
Collaboration graph
[legend]

List of all members.

Classes

struct  const_iterator
struct  iterator

Public Types

typedef XS_String key_type
typedef XS_String value_type

Public Member Functions

 XS_StringMap ()
 XS_StringMap (const XS_StringMap &other)
void operator= (const XS_StringMap &other)
 ~XS_StringMap ()
void clear ()
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
iterator find (const key_type &key)
const_iterator find (const key_type &key) const
value_typeoperator[] (const key_type &key)
bool erase (const key_type &key)
bool operator== (const XS_StringMap &other) const
bool operator!= (const XS_StringMap &other) const

Detailed Description

Definition at line 1072 of file xmlstorage.h.


Member Typedef Documentation

Definition at line 1074 of file xmlstorage.h.

Definition at line 1075 of file xmlstorage.h.


Constructor & Destructor Documentation

XMLStorage::XS_StringMap::XS_StringMap (  ) [inline]

Definition at line 1154 of file xmlstorage.h.

     :  _firstNode(NULL)
    {
    }
XMLStorage::XS_StringMap::XS_StringMap ( const XS_StringMap other ) [inline]

Definition at line 1159 of file xmlstorage.h.

     :  _firstNode(NULL)
    {
        assign(other);
    }
XMLStorage::XS_StringMap::~XS_StringMap (  ) [inline]

Definition at line 1171 of file xmlstorage.h.

References clear().

    {
        clear();
    }

Here is the call graph for this function:


Member Function Documentation

iterator XMLStorage::XS_StringMap::begin (  ) [inline]

Definition at line 1188 of file xmlstorage.h.

Referenced by XMLStorage::XPathElement::matches(), and XMLStorage::XMLNode::original_write_worker().

    {
        return _firstNode;
    }

Here is the caller graph for this function:

const_iterator XMLStorage::XS_StringMap::begin (  ) const [inline]

Definition at line 1193 of file xmlstorage.h.

    {
        return _firstNode;
    }
void XMLStorage::XS_StringMap::clear (  ) [inline]

Definition at line 1176 of file xmlstorage.h.

References XMLStorage::XS_SMNode::_pNext.

Referenced by XMLStorage::XMLNode::clear(), operator=(), and ~XS_StringMap().

    {
        XS_SMNode* node = _firstNode;
        _firstNode = NULL;

        while(node) {
            XS_SMNode* pNext = node->_pNext;
            delete node;
            node = pNext;
        }
    }

Here is the caller graph for this function:

iterator XMLStorage::XS_StringMap::end (  ) [inline]
const_iterator XMLStorage::XS_StringMap::end (  ) const [inline]

Definition at line 1203 of file xmlstorage.h.

    {
        return NULL;
    }
bool XMLStorage::XS_StringMap::erase ( const key_type key ) [inline]

Definition at line 1268 of file xmlstorage.h.

References XMLStorage::XS_StringMap::iterator::ptr().

Referenced by XMLStorage::XMLNode::erase().

    {
        iterator last = NULL;
        iterator node = _firstNode;

        for(; node; node=(last=node)->_pNext) {
            int c = node->first.compare(key);

            if (c == 0) {
                 // remove the node from linked list
                if (last)
                    last->_pNext = node->_pNext;
                else
                    _firstNode = NULL;

                delete node.ptr();

                return true;
            } else if (c > 0)
                break;
        }

        return false;   // key not found
    }

Here is the call graph for this function:

Here is the caller graph for this function:

const_iterator XMLStorage::XS_StringMap::find ( const key_type key ) const [inline]

Definition at line 1222 of file xmlstorage.h.

References XMLStorage::XS_SMNode::_pNext.

    {
        for(const_iterator node=_firstNode; node; node=node->_pNext) {
            int c = node->first.compare(key);

            if (c == 0)
                return node;
            else if (c > 0)
                break;
        }

        return NULL;
    }
iterator XMLStorage::XS_StringMap::find ( const key_type key ) [inline]

Definition at line 1208 of file xmlstorage.h.

References XMLStorage::XS_SMNode::_pNext.

Referenced by XMLStorage::XMLNode::get(), and XMLStorage::XMLNode::AttributeMap::get().

    {
        for(iterator node=_firstNode; node; node=node->_pNext) {
            int c = node->first.compare(key);

            if (c == 0)
                return node;
            else if (c > 0)
                break;
        }

        return NULL;
    }

Here is the caller graph for this function:

bool XMLStorage::XS_StringMap::operator!= ( const XS_StringMap other ) const [inline]

Definition at line 1312 of file xmlstorage.h.

References operator==().

    {
        return !operator==(other);
    }

Here is the call graph for this function:

void XMLStorage::XS_StringMap::operator= ( const XS_StringMap other ) [inline]

Definition at line 1165 of file xmlstorage.h.

References clear().

    {
        clear();
        assign(other);
    }

Here is the call graph for this function:

bool XMLStorage::XS_StringMap::operator== ( const XS_StringMap other ) const [inline]

Definition at line 1293 of file xmlstorage.h.

Referenced by operator!=().

    {
        const_iterator it1 = _firstNode;
        const_iterator it2 = other._firstNode;

        while(it1 || it2) {
            if (!it1 || !it2)
                return false;

            if (it1->first != it2->first)
                return false;

            if (it1->second != it2->second)
                return false;
        }

        return !it1 && !it2;
    }

Here is the caller graph for this function:

value_type& XMLStorage::XS_StringMap::operator[] ( const key_type key ) [inline]

Definition at line 1236 of file xmlstorage.h.

References XMLStorage::XS_StringMap::iterator::ptr().

    {
        iterator last = NULL;
        iterator node = _firstNode;

        for(; node; node=(last=node)->_pNext) {
            int c = node->first.compare(key);

            if (c == 0)
                break; // key matched
            else if (c > 0) {
                node = NULL;
                break;
            }
        }

        if (!node) {
             // insert a new node into the linked list
            node = new XS_SMNode(key);

            if (last) {
                node->_pNext = last->_pNext;
                last->_pNext = node.ptr();
            } else {
                node->_pNext = _firstNode;
                _firstNode = node.ptr();
            }
        }

        return node->second;
    }

Here is the call graph for this function:


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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage