Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions

XMLRPCParser Struct Reference

#include <xmlrpc.h>

Inheritance diagram for XMLRPCParser:
Inheritance graph
[legend]
Collaboration diagram for XMLRPCParser:
Collaboration graph
[legend]

List of all members.

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)

Detailed Description

Definition at line 232 of file xmlrpc.h.


Constructor & Destructor Documentation

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

Here is the call graph for this function:


Member Function Documentation

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

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 251 of file xmlrpc.h.

Referenced by XMLRPCParser().

size_t XMLRPCParser::_value_cnt [protected]

Definition at line 253 of file xmlrpc.h.

Referenced by get_next_type(), more_parameters(), and next_parameter().


The documentation for this struct was generated from the following files: