#include <ulxr_response.h>
Collaboration diagram for ulxr::MethodResponse:
Public Member Functions | |
MethodResponse () | |
Default constructor for an empty response. | |
virtual | ~MethodResponse () |
Destroys the method response. | |
MethodResponse (int fval, const CppString &fstr) | |
Constructs a "fault reponse" to indicate RPC problems. | |
MethodResponse (const Value &val) | |
Constructs a return value from the remote method. | |
MethodResponse (const Void &val) | |
Constructs an empty return value from the remote method. | |
virtual CppString | getSignature (bool deep=false) const |
Returns the signature of this call. | |
virtual std::string | getWbXml () const |
Returns the call as binary xml string. | |
virtual CppString | getXml (int indent=0) const |
Returns the call as xml string. | |
void | setFault (int fval, const CppString &fstr) |
Constructs a "fault reponse" to indicate RPC problems. | |
void | setResult (const Value &val) |
Sets the return value from the remote method. | |
const Value & | getResult () const |
Gets the return value from the remote method. | |
bool | isOK () const |
Tests the method response state. | |
Private Attributes | |
bool | wasOk |
Value | respval |
You should take care to interpret the data correctly as XML-RPC distinguishes between "normal" return values from the remote method and error messages that indicate problems while transporting and invoking the call.
Definition at line 50 of file ulxr_response.h.
ulxr::MethodResponse::MethodResponse | ( | ) | [explicit] |
ulxr::MethodResponse::~MethodResponse | ( | ) | [virtual] |
ulxr::MethodResponse::MethodResponse | ( | int | fval, | |
const CppString & | fstr | |||
) |
Constructs a "fault reponse" to indicate RPC problems.
The number and string are system dependent.
fval | error code | |
fstr | human readable desciption of the error |
Definition at line 59 of file ulxr_response.cpp.
References setFault().
ulxr::MethodResponse::MethodResponse | ( | const Value & | val | ) |
Constructs a return value from the remote method.
the value can be of any type. To return more than one Value at once use an array or a Struct.
val | the return value. |
Definition at line 66 of file ulxr_response.cpp.
References setResult().
ulxr::MethodResponse::MethodResponse | ( | const Void & | val | ) |
Constructs an empty return value from the remote method.
Only exists for completeness and yields the same as the default constructor.
val | the return value. |
Definition at line 53 of file ulxr_response.cpp.
CppString ulxr::MethodResponse::getSignature | ( | bool | deep = false |
) | const [virtual] |
Returns the signature of this call.
The signature consists of all type names in this call delimited by commas. Elements of arrays are surrounded by braces. Structure elements and element pairs of structs are grouped by curly braces.
Example:
Array: [int,double,string] Struct: {{first,int},{second,double}}
deep | if nested types exist, include them |
Definition at line 108 of file ulxr_response.cpp.
std::string ulxr::MethodResponse::getWbXml | ( | ) | const [virtual] |
Returns the call as binary xml string.
The method call is converted to a wbxml sequence. It is prepended with the necessary xml procession instruction with version and encoding set to UTF-8.
Definition at line 143 of file ulxr_response.cpp.
References ulxr::MethodResponseParserWb::wbToken_Fault, ulxr::MethodResponseParserWb::wbToken_MethodResponse, ulxr::MethodResponseParserWb::wbToken_Param, ulxr::MethodResponseParserWb::wbToken_Params, ulxr::WbXmlParser::wbxml_END, ulxr::WbXmlParser::wbxml_START_SEQ_LEN, and ulxr::WbXmlParser::wbxml_START_SEQ_STR.
CppString ulxr::MethodResponse::getXml | ( | int | indent = 0 |
) | const [virtual] |
Returns the call as xml string.
The method cal is converted to an xml text. It is prepended with the necessary xml procession instruction with version and encoding set to UTF-8. The structure of the text is indented to facilitate easy reading.
indent | current indentation level |
Definition at line 114 of file ulxr_response.cpp.
References ulxr::getXmlIndent(), ulxr::getXmlLinefeed(), and ULXR_PCHAR.
void ulxr::MethodResponse::setFault | ( | int | fval, | |
const CppString & | fstr | |||
) |
Constructs a "fault reponse" to indicate RPC problems.
The number and string are system dependent.
fval | error code | |
fstr | human readable desciption of the error |
Definition at line 83 of file ulxr_response.cpp.
References ulxr::Struct::addMember(), ULXR_PCHAR, and ULXR_TRACE.
Referenced by MethodResponse().
void ulxr::MethodResponse::setResult | ( | const Value & | val | ) |
Sets the return value from the remote method.
The value can be of any type. To return more than one Value at once use an Array or a Struct.
val | the return value. |
Definition at line 94 of file ulxr_response.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
Referenced by MethodResponse().
const Value & ulxr::MethodResponse::getResult | ( | ) | const |
Gets the return value from the remote method.
The value can be of any type, even an Array or a Struct. If the response is faulty, is contains a Struct with two elements:
Definition at line 102 of file ulxr_response.cpp.
bool ulxr::MethodResponse::isOK | ( | ) | const |
Tests the method response state.
Definition at line 77 of file ulxr_response.cpp.
Referenced by funtik::MultiProcessRpcServer::storeFuncResult().
bool ulxr::MethodResponse::wasOk [private] |
Definition at line 146 of file ulxr_response.h.
Value ulxr::MethodResponse::respval [private] |
Definition at line 147 of file ulxr_response.h.