#include <xmlstorage.h>


Public Member Functions | |
| XMLMessageReader (const std::string &xml_str, const std::string &system_id=std::string()) | |
| const XMLDoc & | get_document () |
| 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 | |
| template<typename T> | |
| XS_String | get (const T &attr_name) const |
| index operator attribute access | |
| void | put (const XS_String &attr_name, const XS_String &value) |
| attribute setting | |
| 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 | |
| XMLDoc | _msg |
| XMLNode * | _root |
| XMLNode * | _cur |
| std::stack< XMLNode * > | _stack |
Friends | |
| struct | const_XMLPos |
Definition at line 2922 of file xmlstorage.h.
| XMLStorage::XMLMessageReader::XMLMessageReader | ( | const std::string & | xml_str, | |
| const std::string & | system_id = std::string() | |||
| ) | [inline] |
Definition at line 2924 of file xmlstorage.h.
References XMLStorage::XMLPos::XMLPos().
02924 { 02925 XMLMessageReader(const std::string& xml_str, const std::string& system_id=std::string()) 02926 : XMLPos(&_msg) 02927 { 02928 _msg.read_buffer(xml_str.c_str(), xml_str.length(), system_id);

| const XMLDoc& XMLStorage::XMLMessageReader::get_document | ( | ) | [inline] |
| XMLNode& XMLStorage::XMLPos::cur | ( | ) | [inline, inherited] |
| const XMLNode& XMLStorage::XMLPos::cur | ( | ) | const [inline, inherited] |
| XMLStorage::XMLPos::operator const XMLNode * | ( | ) | const [inline, inherited] |
| XMLStorage::XMLPos::operator XMLNode * | ( | ) | [inline, inherited] |
| const XMLNode* XMLStorage::XMLPos::operator-> | ( | ) | const [inline, inherited] |
| XMLNode* XMLStorage::XMLPos::operator-> | ( | ) | [inline, inherited] |
| const XMLNode& XMLStorage::XMLPos::operator * | ( | ) | const [inline, inherited] |
| XMLNode& XMLStorage::XMLPos::operator * | ( | ) | [inline, inherited] |
| XS_String XMLStorage::XMLPos::get | ( | const XS_String & | attr_name, | |
| LPCXSSTR | def = XS_EMPTY_STR | |||
| ) | const [inline, inherited] |
attribute access
Definition at line 1560 of file xmlstorage.h.
01562 { 01563 return _cur->get(attr_name, def);
| XS_String XMLStorage::XMLPos::get | ( | const T & | attr_name | ) | const [inline, inherited] |
index operator attribute access
Definition at line 1572 of file xmlstorage.h.
01573 {return (*_cur)[attr_name];}
| void XMLStorage::XMLPos::put | ( | const XS_String & | attr_name, | |
| const XS_String & | value | |||
| ) | [inline, inherited] |
attribute setting
Definition at line 1566 of file xmlstorage.h.
Referenced by XMLStorage::XMLPos::set_property().
01568 { 01569 _cur->put(attr_name, value);

| void XMLStorage::XMLPos::add_down | ( | XMLNode * | child | ) | [inline, inherited] |
| bool XMLStorage::XMLPos::back | ( | ) | [inline, inherited] |
go back to previous position
Definition at line 1584 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(), XMLStorage::XMLPos::set_property(), test_delete(), test_read(), test_read1(), test_read2(), test_write(), xml_test(), XMLRPCRequest::XMLRPCRequest(), and XMLRPCResult::XMLRPCResult().
01586 { 01587 if (!_stack.empty()) { 01588 _cur = _stack.top(); 01589 _stack.pop(); 01590 return true; 01591 } else 01592 return false;

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

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

| bool XMLStorage::XMLPos::go | ( | const XPath & | xpath | ) | [inherited] |
move to the position defined by xpath in XML tree
Definition at line 112 of file xmlstorage.cpp.
References XMLStorage::XPath::_absolute, XMLStorage::XMLPos::_cur, XMLStorage::XMLPos::_root, XMLStorage::XMLNode::find_relative(), and XMLStorage::XMLPos::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, inherited] |
create child nodes using XPath notation and move to the deepest child
Definition at line 1635 of file xmlstorage.h.
01637 { 01638 XMLNode* node = _cur->create_relative(xpath); 01639 if (!node) 01640 return false; // invalid path specified 01641 01642 go_to(node); 01643 return true;
| void XMLStorage::XMLPos::create | ( | const XS_String & | name | ) | [inline, inherited] |
create node and move to it
Definition at line 1646 of file xmlstorage.h.
Referenced by XMLStorage::XMLWriter::create_node_content(), test_write(), and xml_test().
01648 { 01649 add_down(new XMLNode(name));

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

| void XMLStorage::XMLPos::smart_create | ( | const XS_String & | child_name | ) | [inline, inherited] |
create node if not already existing and move to it
Definition at line 1660 of file xmlstorage.h.
Referenced by XMLStorage::XMLPos::set_property().
01662 { 01663 XMLNode* node = XPathElement(child_name).find(_cur); 01664 01665 if (node) 01666 go_to(node); 01667 else 01668 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, inherited] |
search matching child node identified by key name and an attribute value
Definition at line 1671 of file xmlstorage.h.
01673 { 01674 XMLNode* node = XPathElement(child_name, 0, attr_name, attr_value).find(_cur); 01675 01676 if (node) 01677 go_to(node); 01678 else { 01679 node = new XMLNode(child_name); 01680 add_down(node); 01681 (*node)[attr_name] = attr_value; 01682 }
| int XMLStorage::XMLPos::count | ( | const XPath & | xpath | ) | const [inline, inherited] |
count the nodes matching the given relative XPath expression
Definition at line 1685 of file xmlstorage.h.
Referenced by test_read().
01687 { 01688 return _cur->count(xpath);

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

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

| void XMLStorage::XMLPos::remove_children | ( | const XS_String & | name | ) | [inline, inherited] |
remove all children named 'name'
Definition at line 1758 of file xmlstorage.h.
01760 { 01761 _cur->remove_children(name);
| void XMLStorage::XMLPos::erase | ( | const XS_String & | attr_name | ) | [inline, inherited] |
remove the attribute 'attr_name' from the current node
Definition at line 1764 of file xmlstorage.h.
Referenced by test_delete().
01766 { 01767 _cur->erase(attr_name);

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

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

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

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

| void XMLStorage::XMLPos::go_to | ( | XMLNode * | child | ) | [inline, protected, inherited] |
go to specified node
Definition at line 1789 of file xmlstorage.h.
Referenced by XMLStorage::XMLPos::go().

friend struct const_XMLPos [friend, inherited] |
Definition at line 1782 of file xmlstorage.h.
XMLDoc XMLStorage::XMLMessageReader::_msg [protected] |
Definition at line 2936 of file xmlstorage.h.
XMLNode* XMLStorage::XMLPos::_root [protected, inherited] |
XMLNode* XMLStorage::XMLPos::_cur [protected, inherited] |
Definition at line 1785 of file xmlstorage.h.
Referenced by XMLStorage::XMLPropertyReader::const_iterator::get_node(), XMLStorage::XMLPos::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 XMLStorage::XMLPos::set_property().
std::stack<XMLNode*> XMLStorage::XMLPos::_stack [protected, inherited] |
Definition at line 1786 of file xmlstorage.h.
Referenced by XMLStorage::XMLWriter::operator[](), XMLStorage::XMLWriter::put(), and XMLStorage::XMLWriter::set_content().
1.5.4