#include <xmlstorage.h>


Public Member Functions | |
| XMLPos (XMLNode *root) | |
| XMLPos (const XMLPos &other) | |
| XMLPos (XMLNode *node, const XS_String &name) | |
| XMLPos (XMLNode *node, const XS_String &name, const XS_String &attr_name, const XS_String &attr_value) | |
| XMLPos (const XMLPos &other, const XS_String &name) | |
| XMLPos (const XMLPos &other, const XS_String &name, const XS_String &attr_name, const XS_String &attr_value) | |
| XMLNode & | cur () |
| access to current node | |
| const XMLNode & | cur () const |
| operator const XMLNode * () const | |
| automatic access to current node | |
| operator XMLNode * () | |
| const XMLNode * | operator-> () const |
| XMLNode * | operator-> () |
| const XMLNode & | operator * () const |
| XMLNode & | operator * () |
| XS_String | get (const XS_String &attr_name, LPCXSSTR def=XS_EMPTY_STR) const |
| attribute access | |
| void | put (const XS_String &attr_name, const XS_String &value) |
| attribute setting | |
| template<typename T> | |
| XS_String | get (const T &attr_name) const |
| index operator attribute access | |
| XS_String & | operator[] (const XS_String &attr_name) |
| const XS_String & | operator[] (const XS_String &attr_name) const |
| void | add_down (XMLNode *child) |
| insert children when building tree | |
| 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, size_t &cnt) |
| iterate to the next matching child | |
| bool | go (const XPath &xpath) |
| move to the position defined by xpath in XML tree | |
| bool | create_relative (const XPath &xpath) |
| create child nodes using XPath notation and move to the deepest child | |
| void | create (const XS_String &name) |
| create node and move to it | |
| void | create_node_content (const XS_String &node_name, const XS_String &content) |
| create node with string content | |
| void | smart_create (const XS_String &child_name) |
| create node if not already existing and move to it | |
| void | smart_create (const XS_String &child_name, const XS_String &attr_name, const XS_String &attr_value) |
| search matching child node identified by key name and an attribute value | |
| int | count (const XPath &xpath) const |
| count the nodes matching the given relative XPath expression | |
| int | filter (const XPath &xpath, XMLNode &target) const |
| create a new node tree using the given XPath filter expression | |
| bool | delete_this () |
| delete current node and go back to previous position | |
| void | remove_children (const XS_String &name) |
| remove all children named 'name' | |
| void | erase (const XS_String &attr_name) |
| remove the attribute 'attr_name' from the current node | |
| XS_String & | str () |
| const XS_String & | str () const |
| void | set_property (const XS_String &key, int value, const XS_String &name=XS_PROPERTY) |
| void | set_property (const XS_String &key, double value, const XS_String &name=XS_PROPERTY) |
| void | set_property (const XS_String &key, const XS_String &value, const XS_String &name=XS_PROPERTY) |
| void | set_property (const XS_String &key, const struct XMLBool &value, const XS_String &name=XS_PROPERTY) |
| void | set_property (const XS_String &key, const char *value, const XS_String &name=XS_PROPERTY) |
Protected Member Functions | |
| void | go_to (XMLNode *child) |
| go to specified node | |
Protected Attributes | |
| XMLNode * | _root |
| XMLNode * | _cur |
| std::stack< XMLNode * > | _stack |
Friends | |
| struct | const_XMLPos |
Definition at line 1493 of file xmlstorage.h.
| XMLStorage::XMLPos::XMLPos | ( | XMLNode * | root | ) | [inline] |
Definition at line 1495 of file xmlstorage.h.
Referenced by XMLStorage::XMLMessageReader::XMLMessageReader().

| XMLStorage::XMLPos::XMLPos | ( | const XMLPos & | other | ) | [inline] |
Definition at line 1507 of file xmlstorage.h.
01509 : _root(node), 01510 _cur(node) 01511 { 01512 smart_create(name);
| XMLStorage::XMLPos::XMLPos | ( | XMLNode * | node, | |
| const XS_String & | name, | |||
| const XS_String & | attr_name, | |||
| const XS_String & | attr_value | |||
| ) | [inline] |
Definition at line 1514 of file xmlstorage.h.
01516 : _root(node), 01517 _cur(node) 01518 { 01519 smart_create(name, attr_name, attr_value);
Definition at line 1521 of file xmlstorage.h.
01523 : _root(other._root), 01524 _cur(other._cur) 01525 { 01526 smart_create(name);
| XMLStorage::XMLPos::XMLPos | ( | const XMLPos & | other, | |
| const XS_String & | name, | |||
| const XS_String & | attr_name, | |||
| const XS_String & | attr_value | |||
| ) | [inline] |
Definition at line 1528 of file xmlstorage.h.
01530 : _root(other._root), 01531 _cur(other._cur) 01532 { 01533 smart_create(name, attr_name, attr_value);
| XMLNode& XMLStorage::XMLPos::cur | ( | ) | [inline] |
| const XMLNode& XMLStorage::XMLPos::cur | ( | ) | const [inline] |
| XMLStorage::XMLPos::operator const XMLNode * | ( | ) | const [inline] |
| XMLStorage::XMLPos::operator XMLNode * | ( | ) | [inline] |
| const XMLNode* XMLStorage::XMLPos::operator-> | ( | ) | const [inline] |
| XMLNode* XMLStorage::XMLPos::operator-> | ( | ) | [inline] |
| const XMLNode& XMLStorage::XMLPos::operator * | ( | ) | const [inline] |
| XMLNode& XMLStorage::XMLPos::operator * | ( | ) | [inline] |
| XS_String XMLStorage::XMLPos::get | ( | const XS_String & | attr_name, | |
| LPCXSSTR | def = XS_EMPTY_STR | |||
| ) | const [inline] |
attribute access
Definition at line 1557 of file xmlstorage.h.
01559 { 01560 return _cur->get(attr_name, def);
attribute setting
Definition at line 1563 of file xmlstorage.h.
Referenced by set_property().
01565 { 01566 _cur->put(attr_name, value);

| XS_String XMLStorage::XMLPos::get | ( | const T & | attr_name | ) | const [inline] |
index operator attribute access
Definition at line 1569 of file xmlstorage.h.
01570 {return (*_cur)[attr_name];}
| void XMLStorage::XMLPos::add_down | ( | XMLNode * | child | ) | [inline] |
| bool XMLStorage::XMLPos::back | ( | ) | [inline] |
go back to previous position
Definition at line 1581 of file xmlstorage.h.
Referenced by XMLStorage::XMLWriter::create_node_content(), XMLRPCParser::get_any(), XMLRPCParser::get_array(), XMLRPCParser::get_binary(), XMLRPCParser::get_bool(), XMLRPCParser::get_date(), XMLRPCParser::get_double(), XMLRPCParser::get_int(), XMLRPCParser::get_parameter_types(), XMLRPCParser::get_string(), XMLRPCParser::get_struct(), set_property(), test_delete(), test_read(), test_read1(), test_read2(), test_write(), xml_test(), XMLRPCRequest::XMLRPCRequest(), and XMLRPCResult::XMLRPCResult().
01583 { 01584 if (!_stack.empty()) { 01585 _cur = _stack.top(); 01586 _stack.pop(); 01587 return true; 01588 } else 01589 return false;

| bool XMLStorage::XMLPos::go_down | ( | ) | [inline] |
go down to first child
Definition at line 1592 of file xmlstorage.h.
Referenced by XMLRPCParser::next_parameter(), test_delete(), XMLRPCParser::XMLRPCParser(), XMLRPCRequest::XMLRPCRequest(), and XMLRPCResult::XMLRPCResult().
01594 { 01595 XMLNode* node = _cur->get_first_child(); 01596 01597 if (node) { 01598 go_to(node); 01599 return true; 01600 } else 01601 return false;

| bool XMLStorage::XMLPos::go_down | ( | const XS_String & | child_name, | |
| int | n = 0 | |||
| ) | [inline] |
search for child and go down
Definition at line 1604 of file xmlstorage.h.
01606 { 01607 XMLNode* node = XPathElement(child_name, n).find(_cur); 01608 01609 if (node) { 01610 go_to(node); 01611 return true; 01612 } else 01613 return false;
| bool XMLStorage::XMLPos::iterate | ( | const XS_String & | child_name, | |
| size_t & | cnt | |||
| ) | [inline] |
iterate to the next matching child
Definition at line 1616 of file xmlstorage.h.
Referenced by XMLRPCParser::get_parameter_types(), and XMLRPCParser::next_parameter().
01618 { 01619 XMLNode* node = XPathElement(child_name, cnt).find(_cur); 01620 01621 if (node) { 01622 go_to(node); 01623 ++cnt; 01624 return true; 01625 } else 01626 return false;

| bool XMLStorage::XMLPos::go | ( | const XPath & | xpath | ) |
move to the position defined by xpath in XML tree
Definition at line 112 of file xmlstorage.cpp.
References XMLStorage::XPath::_absolute, _cur, _root, XMLStorage::XMLNode::find_relative(), and go_to().
Referenced by test_read(), test_read1(), test_read2(), xml_test(), and XMLRPCResult::XMLRPCResult().
00113 { 00114 XMLNode* node = xpath._absolute? _root: _cur; 00115 00116 node = node->find_relative(xpath); 00117 00118 if (node) { 00119 go_to(node); 00120 return true; 00121 } else 00122 return false; 00123 }


| bool XMLStorage::XMLPos::create_relative | ( | const XPath & | xpath | ) | [inline] |
create child nodes using XPath notation and move to the deepest child
Definition at line 1632 of file xmlstorage.h.
01634 { 01635 XMLNode* node = _cur->create_relative(xpath); 01636 if (!node) 01637 return false; // invalid path specified 01638 01639 go_to(node); 01640 return true;
| void XMLStorage::XMLPos::create | ( | const XS_String & | name | ) | [inline] |
create node and move to it
Definition at line 1643 of file xmlstorage.h.
Referenced by XMLStorage::XMLWriter::create_node_content(), test_write(), and xml_test().
01645 { 01646 add_down(new XMLNode(name));

| void XMLStorage::XMLPos::create_node_content | ( | const XS_String & | node_name, | |
| const XS_String & | content | |||
| ) | [inline] |
create node with string content
Definition at line 1649 of file xmlstorage.h.
References XMLStorage::XMLNode::set_content().
01651 { 01652 XMLNode* pNode = new XMLNode(node_name); 01653 pNode->set_content(content); 01654 _cur->add_child(pNode);

| void XMLStorage::XMLPos::smart_create | ( | const XS_String & | child_name | ) | [inline] |
create node if not already existing and move to it
Definition at line 1657 of file xmlstorage.h.
Referenced by set_property().
01659 { 01660 XMLNode* node = XPathElement(child_name).find(_cur); 01661 01662 if (node) 01663 go_to(node); 01664 else 01665 add_down(new XMLNode(child_name));

| void XMLStorage::XMLPos::smart_create | ( | const XS_String & | child_name, | |
| const XS_String & | attr_name, | |||
| const XS_String & | attr_value | |||
| ) | [inline] |
search matching child node identified by key name and an attribute value
Definition at line 1668 of file xmlstorage.h.
01670 { 01671 XMLNode* node = XPathElement(child_name, 0, attr_name, attr_value).find(_cur); 01672 01673 if (node) 01674 go_to(node); 01675 else { 01676 node = new XMLNode(child_name); 01677 add_down(node); 01678 (*node)[attr_name] = attr_value; 01679 }
| int XMLStorage::XMLPos::count | ( | const XPath & | xpath | ) | const [inline] |
count the nodes matching the given relative XPath expression
Definition at line 1682 of file xmlstorage.h.
Referenced by test_read().
01684 { 01685 return _cur->count(xpath);

create a new node tree using the given XPath filter expression
Definition at line 1688 of file xmlstorage.h.
Referenced by test_read().
01690 { 01691 return _cur->filter(xpath, target);

| bool XMLStorage::XMLPos::delete_this | ( | ) | [inline] |
delete current node and go back to previous position
Definition at line 1740 of file xmlstorage.h.
References XMLStorage::XMLNode::_children.
Referenced by test_delete().
01742 { 01743 if (!_stack.empty()) { 01744 XMLNode* pLast = _stack.top(); 01745 01746 if (pLast->_children.remove(_cur)) { 01747 _cur = _stack.top(); 01748 return true; 01749 } 01750 } 01751 01752 return false;

| void XMLStorage::XMLPos::remove_children | ( | const XS_String & | name | ) | [inline] |
remove all children named 'name'
Definition at line 1755 of file xmlstorage.h.
01757 { 01758 _cur->remove_children(name);
| void XMLStorage::XMLPos::erase | ( | const XS_String & | attr_name | ) | [inline] |
remove the attribute 'attr_name' from the current node
Definition at line 1761 of file xmlstorage.h.
Referenced by test_delete().
01763 { 01764 _cur->erase(attr_name);

| XS_String& XMLStorage::XMLPos::str | ( | ) | [inline] |
| const XS_String& XMLStorage::XMLPos::str | ( | ) | const [inline] |
| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, | |
| int | value, | |||
| const XS_String & | name = XS_PROPERTY | |||
| ) | [inline] |
Definition at line 2274 of file xmlstorage.h.
References _cur, back(), smart_create(), XMLStorage::XS_KEY, and XMLStorage::XS_VALUE.
02276 { 02277 smart_create(name, XS_KEY, key); 02278 XMLIntRef(_cur, XS_VALUE) = value; 02279 back();

| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, | |
| double | value, | |||
| const XS_String & | name = XS_PROPERTY | |||
| ) | [inline] |
Definition at line 2281 of file xmlstorage.h.
References _cur, back(), smart_create(), XMLStorage::XS_KEY, and XMLStorage::XS_VALUE.
02283 { 02284 smart_create(name, XS_KEY, key); 02285 XMLDoubleRef(_cur, XS_VALUE) = value; 02286 back();

| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, | |
| const XS_String & | value, | |||
| const XS_String & | name = XS_PROPERTY | |||
| ) | [inline] |
Definition at line 2288 of file xmlstorage.h.
References back(), put(), smart_create(), XMLStorage::XS_KEY, and XMLStorage::XS_VALUE.
02290 { 02291 smart_create(name, XS_KEY, key); 02292 put(XS_VALUE, value); 02293 back();

| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, | |
| const struct XMLBool & | value, | |||
| const XS_String & | name = XS_PROPERTY | |||
| ) |
| void XMLStorage::XMLPos::set_property | ( | const XS_String & | key, | |
| const char * | value, | |||
| const XS_String & | name = XS_PROPERTY | |||
| ) | [inline] |
Definition at line 1775 of file xmlstorage.h.
References XMLStorage::XS_String::XS_String().
01777 {set_property(key, XS_String(value), name);}

| void XMLStorage::XMLPos::go_to | ( | XMLNode * | child | ) | [inline, protected] |
friend struct const_XMLPos [friend] |
Definition at line 1779 of file xmlstorage.h.
XMLNode* XMLStorage::XMLPos::_root [protected] |
XMLNode* XMLStorage::XMLPos::_cur [protected] |
Definition at line 1782 of file xmlstorage.h.
Referenced by XMLStorage::XMLPropertyReader::const_iterator::get_node(), go(), XMLStorage::XMLPropertyReader::const_iterator::operator *(), XMLStorage::XMLPropertyReader::const_iterator::operator BaseIterator(), XMLStorage::XMLPropertyReader::const_iterator::operator!=(), XMLStorage::XMLPropertyReader::const_iterator::operator++(), XMLStorage::XMLPropertyReader::const_iterator::operator==(), and set_property().
std::stack<XMLNode*> XMLStorage::XMLPos::_stack [protected] |
Definition at line 1783 of file xmlstorage.h.
Referenced by XMLStorage::XMLWriter::operator[](), XMLStorage::XMLWriter::put(), and XMLStorage::XMLWriter::set_content().
1.5.4