#include <xmlstorage.h>


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) | |
| XS_StringMap & | 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_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 |
Private Member Functions | |
| void | assign (const XS_StringMap &other) |
Private Attributes | |
| XS_SMNode * | _firstNode |
Definition at line 1110 of file xmlstorage.h.
Definition at line 1112 of file xmlstorage.h.
Definition at line 1113 of file xmlstorage.h.
| XMLStorage::XS_StringMap::XS_StringMap | ( | ) | [inline] |
Definition at line 1207 of file xmlstorage.h.
: _firstNode(NULL) { }
| XMLStorage::XS_StringMap::XS_StringMap | ( | const XS_StringMap & | other ) | [inline] |
Definition at line 1212 of file xmlstorage.h.
References assign().
: _firstNode(NULL) { assign(other); }

| XMLStorage::XS_StringMap::~XS_StringMap | ( | ) | [inline] |
Definition at line 1225 of file xmlstorage.h.
References clear().
{
clear();
}

| void XMLStorage::XS_StringMap::assign | ( | const XS_StringMap & | other ) | [inline, private] |
Definition at line 1397 of file xmlstorage.h.
References _firstNode.
Referenced by operator=(), and XS_StringMap().
{
if (other._firstNode)
_firstNode = new XS_SMNode(*other._firstNode);
}

| const_iterator XMLStorage::XS_StringMap::begin | ( | ) | const [inline] |
| iterator XMLStorage::XS_StringMap::begin | ( | ) | [inline] |
Definition at line 1245 of file xmlstorage.h.
References _firstNode.
Referenced by XMLStorage::XPathElement::matches(), and XMLStorage::XMLNode::original_write_worker().
{
return _firstNode;
}

| void XMLStorage::XS_StringMap::clear | ( | ) | [inline] |
Definition at line 1230 of file xmlstorage.h.
References _firstNode, and 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;
node->_pNext = NULL;
delete node;
node = pNext;
}
}

| bool XMLStorage::XS_StringMap::empty | ( | ) | const [inline] |
| iterator XMLStorage::XS_StringMap::end | ( | ) | [inline] |
Definition at line 1255 of file xmlstorage.h.
Referenced by XMLStorage::XMLNode::get(), XMLStorage::XMLNode::AttributeMap::get(), XMLStorage::XPathElement::matches(), XMLStorage::XMLNode::original_write_worker(), and XMLStorage::ParseContext::process_next().
{
return NULL;
}

| const_iterator XMLStorage::XS_StringMap::end | ( | ) | const [inline] |
Definition at line 1260 of file xmlstorage.h.
{
return NULL;
}
| bool XMLStorage::XS_StringMap::erase | ( | const key_type & | key ) | [inline] |
Definition at line 1340 of file xmlstorage.h.
References _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] |
Definition at line 1279 of file xmlstorage.h.
References _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 _firstNode, and 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;
}

| bool XMLStorage::XS_StringMap::operator!= | ( | const XS_StringMap & | other ) | const [inline] |
Definition at line 1389 of file xmlstorage.h.
References operator==().
{
return !operator==(other);
}

| XS_StringMap& XMLStorage::XS_StringMap::operator= | ( | const XS_StringMap & | other ) | [inline] |
| bool XMLStorage::XS_StringMap::operator== | ( | const XS_StringMap & | other ) | const [inline] |
Definition at line 1367 of file xmlstorage.h.
References _firstNode.
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;
it1 = it1->_pNext;
it2 = it2->_pNext;
}
return !it1 && !it2;
}

| value_type& XMLStorage::XS_StringMap::operator[] | ( | const key_type & | key ) | [inline] |
Definition at line 1293 of file xmlstorage.h.
References _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] |
Definition at line 1330 of file xmlstorage.h.
References _firstNode, and XMLStorage::XS_SMNode::_pNext.
{
size_t count = 0;
for(iterator node=_firstNode; node; node=node->_pNext)
++count;
return count;
}
XS_SMNode* XMLStorage::XS_StringMap::_firstNode [private] |
Definition at line 1395 of file xmlstorage.h.
Referenced by assign(), begin(), clear(), empty(), erase(), find(), operator==(), operator[](), and size().
1.7.2