Public Types | Public Member Functions

XMLStorage::XMLNode::AttributeMap Struct Reference

map of XML node attributes More...

#include <xmlstorage.h>

Inheritance diagram for XMLStorage::XMLNode::AttributeMap:
Inheritance graph
[legend]
Collaboration diagram for XMLStorage::XMLNode::AttributeMap:
Collaboration graph
[legend]

List of all members.

Public Types

typedef XS_String key_type
typedef XS_String value_type

Public Member Functions

XS_String get (const char *x, LPCXSSTR def=XS_EMPTY_STR) const
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 empty () const
size_t size () const
bool erase (const key_type &key)
bool operator== (const XS_StringMap &other) const
bool operator!= (const XS_StringMap &other) const

Detailed Description

map of XML node attributes

Definition at line 1495 of file xmlstorage.h.


Member Typedef Documentation

Definition at line 1112 of file xmlstorage.h.

Definition at line 1113 of file xmlstorage.h.


Member Function Documentation

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

Definition at line 1245 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode.

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, inherited]

Definition at line 1250 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode.

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

Definition at line 1230 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode, and XMLStorage::XS_SMNode::_pNext.

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

    {
        XS_SMNode* node = _firstNode;
        _firstNode = NULL;

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

            delete node;

            node = pNext;
        }
    }

Here is the caller graph for this function:

bool XMLStorage::XS_StringMap::empty (  ) const [inline, inherited]

Definition at line 1325 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode.

    {
        return _firstNode == NULL;
    }
iterator XMLStorage::XS_StringMap::end (  ) [inline, inherited]

Definition at line 1255 of file xmlstorage.h.

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

    {
        return NULL;
    }

Here is the caller graph for this function:

const_iterator XMLStorage::XS_StringMap::end (  ) const [inline, inherited]

Definition at line 1260 of file xmlstorage.h.

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

Definition at line 1340 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode, and 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 = node->_pNext;

                node->_pNext = 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, inherited]

Definition at line 1279 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode, and 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, inherited]

Definition at line 1265 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode, and XMLStorage::XS_SMNode::_pNext.

Referenced by XMLStorage::XMLNode::get(), and 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:

XS_String XMLStorage::XMLNode::AttributeMap::get ( const char *  x,
LPCXSSTR  def = XS_EMPTY_STR 
) const [inline]

Definition at line 1497 of file xmlstorage.h.

References XMLStorage::XS_StringMap::end(), and XMLStorage::XS_StringMap::find().

Referenced by XMLStorage::XMLNode::operator[](), and XMLStorage::ParseContext::process_next().

        {
            const_iterator found = find(x);

            if (found != end())
                return found->second;
            else
                return def;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1389 of file xmlstorage.h.

References XMLStorage::XS_StringMap::operator==().

    {
        return !operator==(other);
    }

Here is the call graph for this function:

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

Definition at line 1367 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode.

Referenced by XMLStorage::XS_StringMap::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;

            it1 = it1->_pNext;
            it2 = it2->_pNext;
        }

        return !it1 && !it2;
    }

Here is the caller graph for this function:

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

Definition at line 1293 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode, and 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:

size_t XMLStorage::XS_StringMap::size (  ) const [inline, inherited]

Definition at line 1330 of file xmlstorage.h.

References XMLStorage::XS_StringMap::_firstNode, and XMLStorage::XS_SMNode::_pNext.

    {
        size_t count = 0;

        for(iterator node=_firstNode; node; node=node->_pNext)
            ++count;

        return count;
    }

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