#include <xmlrpc.h>


Public Member Functions | |
| XMLRPCParser (const string &xml_str, const string &keyword) | |
| string | get_any () |
| int | get_int () |
| double | get_double () |
| bool | get_bool () |
| string | get_string () |
| ISODate | get_date () |
| Binary | get_binary () |
| XMLRPCArray | get_array () |
| XMLRPCStruct | get_struct () |
| bool | more_parameters () const |
| XMLRPC_TYPE | get_next_type () const |
| size_t | get_parameter_types (TypeList &types) const |
Protected Attributes | |
| XMLDoc | _doc |
| XMLPos | _pos |
| size_t | _value_cnt |
Private Member Functions | |
| bool | next_parameter () |
Static Private Member Functions | |
| static XMLRPC_TYPE | get_param_type (const XMLNode *pNode) |
Definition at line 232 of file xmlrpc.h.
| XMLRPCParser::XMLRPCParser | ( | const string & | xml_str, |
| const string & | keyword | ||
| ) |
Definition at line 308 of file xmlrpc.cpp.
References _doc, _pos, XMLStorage::XMLPos::go_down(), and XMLStorage::XMLDoc::read_buffer().
: _pos(&_doc), _value_cnt(0) { if (_doc.read_buffer(xml_str)) _pos.go_down(keyword); }

| string XMLRPCParser::get_any | ( | ) |
Definition at line 392 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
{
if (next_parameter()) {
const string& ret = XMLRPCValue::get_any(_pos);
_pos.back(); // </value>
_pos.back(); // </param>
return ret;
} else
throw Exception("missing parameter value");
}

| XMLRPCArray XMLRPCParser::get_array | ( | ) |
Definition at line 483 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
Referenced by client_test().
{
if (next_parameter()) {
XMLRPCArray ret = XMLRPCValue::get_array(_pos);
_pos.back();
_pos.back();
return ret;
} else
throw Exception("missing parameter value");
}


| Binary XMLRPCParser::get_binary | ( | ) |
Definition at line 470 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
Referenced by client_test(), and server_test().
{
if (next_parameter()) {
Binary ret = XMLRPCValue::get_binary(_pos);
_pos.back();
_pos.back();
return ret; //TODO sub-optimal: invokes the copy constructor
} else
throw Exception("missing parameter value");
}


| bool XMLRPCParser::get_bool | ( | ) |
Definition at line 431 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
Referenced by server_test().
{
if (next_parameter()) {
bool ret = XMLRPCValue::get_bool(_pos);
_pos.back();
_pos.back();
return ret;
} else
throw Exception("missing parameter value");
}


| ISODate XMLRPCParser::get_date | ( | ) |
Definition at line 457 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
Referenced by client_test(), and server_test().
{
if (next_parameter()) {
ISODate ret = XMLRPCValue::get_date(_pos);
_pos.back();
_pos.back();
return ret;
} else
throw Exception("missing parameter value");
}


| double XMLRPCParser::get_double | ( | ) |
Definition at line 418 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
Referenced by client_test(), and server_test().
{
if (next_parameter()) {
double ret = XMLRPCValue::get_double(_pos);
_pos.back();
_pos.back();
return ret;
} else
throw Exception("missing parameter value");
}


| int XMLRPCParser::get_int | ( | ) |
Definition at line 405 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
Referenced by client_test(), and server_test().
{
if (next_parameter()) {
int ret = XMLRPCValue::get_int(_pos);
_pos.back(); // </value>
_pos.back(); // </param>
return ret;
} else
throw Exception("missing parameter value");
}


| XMLRPC_TYPE XMLRPCParser::get_next_type | ( | ) | const |
Definition at line 332 of file xmlrpc.cpp.
References _pos, _value_cnt, get_param_type(), and XRT_VOID.
{
XPath xpath;
xpath.push_back(XPathElement("param", _value_cnt));
const XMLNode* pNode = _pos->find_relative(xpath);
if (!pNode)
return XRT_VOID;
return get_param_type(pNode);
}

| XMLRPC_TYPE XMLRPCParser::get_param_type | ( | const XMLNode * | pNode ) | [static, private] |
Definition at line 344 of file xmlrpc.cpp.
References XMLStorage::XMLNode::find_relative(), XMLStorage::XMLNode::get_first_child(), XRT_ARRAY, XRT_BINARY, XRT_BOOLEAN, XRT_DATE, XRT_DOUBLE, XRT_INT, XRT_STRING, XRT_STRUCT, and XRT_VOID.
Referenced by get_next_type(), and get_parameter_types().
{
pNode = pNode->find_relative("value");
if (!pNode)
return XRT_VOID;
pNode = pNode->get_first_child();
if (!pNode)
return XRT_STRING;
const XS_String& tag = *pNode;
if (tag=="i4" || tag=="int")
return XRT_INT;
else if (tag == "double")
return XRT_DOUBLE;
else if (tag == "boolean")
return XRT_BOOLEAN;
else if (tag == "string")
return XRT_STRING;
else if (tag == "dateTime.iso8601")
return XRT_DATE;
else if (tag == "base64")
return XRT_BINARY;
else if (tag == "array")
return XRT_ARRAY;
else if (tag == "struct")
return XRT_STRUCT;
else
return XRT_VOID;
}


| size_t XMLRPCParser::get_parameter_types | ( | TypeList & | types ) | const |
Definition at line 376 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), get_param_type(), and XMLStorage::XMLPos::iterate().
Referenced by server_test().
{
size_t n = 0;
XMLPos pos = _pos;
while(pos.iterate("param", n)) {
types.push_back(get_param_type(pos));
pos.back();
}
return n;
}


| string XMLRPCParser::get_string | ( | ) |
Definition at line 444 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
Referenced by client_test(), and server_test().
{
if (next_parameter()) {
string ret = XMLRPCValue::get_string(_pos);
_pos.back();
_pos.back();
return ret;
} else
throw Exception("missing parameter value");
}


| XMLRPCStruct XMLRPCParser::get_struct | ( | ) |
Definition at line 496 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
Referenced by client_test().
{
if (next_parameter()) {
XMLRPCStruct ret = XMLRPCValue::get_struct(_pos);
_pos.back();
_pos.back();
return ret;
} else
throw Exception("missing parameter value");
}


| bool XMLRPCParser::more_parameters | ( | ) | const |
Definition at line 324 of file xmlrpc.cpp.
References _pos, and _value_cnt.
Referenced by server_test().
{
XPath xpath;
xpath.push_back(XPathElement("param", _value_cnt));
return _pos->find_relative(xpath) != NULL;
}

| bool XMLRPCParser::next_parameter | ( | ) | [private] |
Definition at line 316 of file xmlrpc.cpp.
References _pos, _value_cnt, XMLStorage::XMLPos::go_down(), and XMLStorage::XMLPos::iterate().
Referenced by get_any(), get_array(), get_binary(), get_bool(), get_date(), get_double(), get_int(), get_string(), and get_struct().
{
if (!_pos.iterate("param", _value_cnt))
return false;
return _pos.go_down("value");
}


XMLDoc XMLRPCParser::_doc [protected] |
Definition at line 251 of file xmlrpc.h.
Referenced by XMLRPCParser().
XMLPos XMLRPCParser::_pos [protected] |
Definition at line 252 of file xmlrpc.h.
Referenced by get_any(), get_array(), get_binary(), get_bool(), get_date(), get_double(), get_int(), get_next_type(), get_parameter_types(), get_string(), get_struct(), more_parameters(), next_parameter(), XMLRPCParser(), XMLRPCRequest::XMLRPCRequest(), and XMLRPCResult::XMLRPCResult().
size_t XMLRPCParser::_value_cnt [protected] |
Definition at line 253 of file xmlrpc.h.
Referenced by get_next_type(), more_parameters(), and next_parameter().
1.7.2