map of XML node attributes More...
#include <xmlstorage.h>
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_type & | operator[] (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 |
map of XML node attributes
Definition at line 1495 of file xmlstorage.h.
typedef XS_String XMLStorage::XS_StringMap::key_type [inherited] |
Definition at line 1112 of file xmlstorage.h.
typedef XS_String XMLStorage::XS_StringMap::value_type [inherited] |
Definition at line 1113 of file xmlstorage.h.
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; }
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; } }
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;
}
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 }
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; }
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; }
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().
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); }
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; }
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; }
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; }