#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 |
| int | _value_cnt |
Private Member Functions | |
| bool | next_parameter () |
Static Private Member Functions | |
| static XMLRPC_TYPE | get_param_type (const XMLNode *pNode) |
Definition at line 235 of file xmlrpc.h.
| XMLRPC::XMLRPCParser::XMLRPCParser | ( | const string & | xml_str, |
| const string & | keyword | ||
| ) |
Definition at line 311 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 XMLRPC::XMLRPCParser::get_any | ( | ) |
Definition at line 395 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 XMLRPC::XMLRPCParser::get_array | ( | ) |
Definition at line 486 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
{
if (next_parameter()) {
XMLRPCArray ret = XMLRPCValue::get_array(_pos);
_pos.back();
_pos.back();
return ret;
} else
throw Exception("missing parameter value");
}

| Binary XMLRPC::XMLRPCParser::get_binary | ( | ) |
Definition at line 473 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
{
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 XMLRPC::XMLRPCParser::get_bool | ( | ) |
Definition at line 434 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
{
if (next_parameter()) {
bool ret = XMLRPCValue::get_bool(_pos);
_pos.back();
_pos.back();
return ret;
} else
throw Exception("missing parameter value");
}

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

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

| int XMLRPC::XMLRPCParser::get_int | ( | ) |
Definition at line 408 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), and next_parameter().
{
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 XMLRPC::XMLRPCParser::get_next_type | ( | ) | const |
Definition at line 335 of file xmlrpc.cpp.
References _pos, _value_cnt, get_param_type(), and XMLRPC::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 XMLRPC::XMLRPCParser::get_param_type | ( | const XMLNode * | pNode ) | [static, private] |
Definition at line 347 of file xmlrpc.cpp.
References XMLStorage::XMLNode::find_relative(), XMLStorage::XMLNode::get_first_child(), XMLRPC::XRT_ARRAY, XMLRPC::XRT_BINARY, XMLRPC::XRT_BOOLEAN, XMLRPC::XRT_DATE, XMLRPC::XRT_DOUBLE, XMLRPC::XRT_INT, XMLRPC::XRT_STRING, XMLRPC::XRT_STRUCT, and XMLRPC::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 XMLRPC::XMLRPCParser::get_parameter_types | ( | TypeList & | types ) | const |
Definition at line 379 of file xmlrpc.cpp.
References _pos, XMLStorage::XMLPos::back(), get_param_type(), and XMLStorage::XMLPos::iterate().
{
int n = 0;
XMLPos pos = _pos;
while(pos.iterate("param", n)) {
types.push_back(get_param_type(pos));
pos.back();
}
return n;
}

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

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

| bool XMLRPC::XMLRPCParser::more_parameters | ( | ) | const |
Definition at line 327 of file xmlrpc.cpp.
References _pos, and _value_cnt.
{
XPath xpath;
xpath.push_back(XPathElement("param", _value_cnt));
return _pos->find_relative(xpath) != NULL;
}
| bool XMLRPC::XMLRPCParser::next_parameter | ( | ) | [private] |
Definition at line 319 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 XMLRPC::XMLRPCParser::_doc [protected] |
Definition at line 254 of file xmlrpc.h.
Referenced by XMLRPCParser().
XMLPos XMLRPC::XMLRPCParser::_pos [protected] |
Definition at line 255 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(), and XMLRPC::XMLRPCResult::XMLRPCResult().
int XMLRPC::XMLRPCParser::_value_cnt [protected] |
Definition at line 256 of file xmlrpc.h.
Referenced by get_next_type(), more_parameters(), and next_parameter().
1.7.2