XMLStorage::XMLMessageReader Struct Reference

Reader for XML Messages. More...

#include <xmlstorage.h>

Inheritance diagram for XMLStorage::XMLMessageReader:

Inheritance graph
[legend]
Collaboration diagram for XMLStorage::XMLMessageReader:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 XMLMessageReader (const std::string &xml_str, const std::string &system_id=std::string())
const XMLDocget_document ()
XMLNodecur ()
 access to current node
const XMLNodecur () const
 operator const XMLNode * () const
 automatic access to current node
 operator XMLNode * ()
const XMLNodeoperator-> () const
XMLNodeoperator-> ()
const XMLNodeoperator * () const
XMLNodeoperator * ()
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_Stringoperator[] (const XS_String &attr_name)
const XS_Stringoperator[] (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_Stringstr ()
const XS_Stringstr () 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


Detailed Description

Reader for XML Messages.

Definition at line 2922 of file xmlstorage.h.


Constructor & Destructor Documentation

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);

Here is the call graph for this function:


Member Function Documentation

const XMLDoc& XMLStorage::XMLMessageReader::get_document (  )  [inline]

Definition at line 2930 of file xmlstorage.h.

02932     {
02933         return _msg;

XMLNode& XMLStorage::XMLPos::cur (  )  [inline, inherited]

access to current node

Definition at line 1539 of file xmlstorage.h.

01541     {
01542         return *_cur;

const XMLNode& XMLStorage::XMLPos::cur (  )  const [inline, inherited]

Definition at line 1544 of file xmlstorage.h.

01546     {
01547         return *_cur;

XMLStorage::XMLPos::operator const XMLNode * (  )  const [inline, inherited]

automatic access to current node

Definition at line 1550 of file xmlstorage.h.

01551 {return _cur;}

XMLStorage::XMLPos::operator XMLNode * (  )  [inline, inherited]

Definition at line 1551 of file xmlstorage.h.

01551 {return _cur;}

const XMLNode* XMLStorage::XMLPos::operator-> (  )  const [inline, inherited]

Definition at line 1553 of file xmlstorage.h.

01554 {return _cur;}

XMLNode* XMLStorage::XMLPos::operator-> (  )  [inline, inherited]

Definition at line 1554 of file xmlstorage.h.

01554 {return _cur;}

const XMLNode& XMLStorage::XMLPos::operator * (  )  const [inline, inherited]

Definition at line 1556 of file xmlstorage.h.

01557 {return *_cur;}

XMLNode& XMLStorage::XMLPos::operator * (  )  [inline, inherited]

Definition at line 1557 of file xmlstorage.h.

01557 {return *_cur;}

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);

template<typename T>
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);

Here is the caller graph for this function:

XS_String& XMLStorage::XMLPos::operator[] ( const XS_String attr_name  )  [inline, inherited]

Definition at line 1573 of file xmlstorage.h.

01573 {return (*_cur)[attr_name];}

const XS_String& XMLStorage::XMLPos::operator[] ( const XS_String attr_name  )  const [inline, inherited]

Definition at line 1574 of file xmlstorage.h.

01574 {return (*_cur)[attr_name];}

void XMLStorage::XMLPos::add_down ( XMLNode child  )  [inline, inherited]

insert children when building tree

Definition at line 1577 of file xmlstorage.h.

01579     {
01580         _cur->add_child(child);
01581         go_to(child);

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;

Here is the caller graph for this function:

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;

Here is the caller graph for this function:

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;

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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));

Here is the caller graph for this function:

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);

Here is the call graph for this function:

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));

Here is the caller graph for this function:

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);

Here is the caller graph for this function:

int XMLStorage::XMLPos::filter ( const XPath xpath,
XMLNode target 
) const [inline, inherited]

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);

Here is the caller graph for this function:

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;

Here is the caller graph for this function:

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);

Here is the caller graph for this function:

XS_String& XMLStorage::XMLPos::str (  )  [inline, inherited]

Definition at line 1769 of file xmlstorage.h.

01770 {return *_cur;}

const XS_String& XMLStorage::XMLPos::str (  )  const [inline, inherited]

Definition at line 1770 of file xmlstorage.h.

01770 {return *_cur;}

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();

Here is the call graph for this function:

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();

Here is the call graph for this function:

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();

Here is the call graph for this function:

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);}

Here is the call graph for this function:

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().

01791     {
01792         _stack.push(_cur);
01793         _cur = child;

Here is the caller graph for this function:


Friends And Related Function Documentation

friend struct const_XMLPos [friend, inherited]

Definition at line 1782 of file xmlstorage.h.


Member Data Documentation

XMLDoc XMLStorage::XMLMessageReader::_msg [protected]

Definition at line 2936 of file xmlstorage.h.

XMLNode* XMLStorage::XMLPos::_root [protected, inherited]

Definition at line 1784 of file xmlstorage.h.

Referenced by XMLStorage::XMLPos::go().

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().


The documentation for this struct was generated from the following file:
Generated on Mon Aug 30 00:06:08 2010 for XMLStorage/C++ by  doxygen 1.5.4