BOSS 7.0.3
BESIII Offline Software System
|
RPC method arguments and results are represented by Values. More...
#include <XmlRpcValue.h>
Public Types | |
enum | Type { TypeInvalid , TypeBoolean , TypeInt , TypeDouble , TypeString , TypeDateTime , TypeBase64 , TypeArray , TypeStruct } |
typedef std::vector< char > | BinaryData |
typedef std::vector< XmlRpcValue > | ValueArray |
typedef std::map< std::string, XmlRpcValue > | ValueStruct |
Public Member Functions | |
XmlRpcValue () | |
Constructors. | |
XmlRpcValue (bool value) | |
XmlRpcValue (int value) | |
XmlRpcValue (double value) | |
XmlRpcValue (std::string const &value) | |
XmlRpcValue (const char *value) | |
XmlRpcValue (struct tm *value) | |
XmlRpcValue (void *value, int nBytes) | |
XmlRpcValue (std::string const &xml, int *offset) | |
Construct from xml, beginning at *offset chars into the string, updates offset. | |
XmlRpcValue (XmlRpcValue const &rhs) | |
Copy. | |
~XmlRpcValue () | |
Destructor (make virtual if you want to subclass) | |
void | clear () |
Erase the current value. | |
XmlRpcValue & | operator= (XmlRpcValue const &rhs) |
XmlRpcValue & | operator= (int const &rhs) |
XmlRpcValue & | operator= (double const &rhs) |
XmlRpcValue & | operator= (const char *rhs) |
bool | operator== (XmlRpcValue const &other) const |
bool | operator!= (XmlRpcValue const &other) const |
operator bool & () | |
operator int & () | |
operator double & () | |
operator std::string & () | |
operator BinaryData & () | |
operator struct tm & () | |
XmlRpcValue const & | operator[] (int i) const |
XmlRpcValue & | operator[] (int i) |
XmlRpcValue & | operator[] (std::string const &k) |
XmlRpcValue & | operator[] (const char *k) |
bool | valid () const |
Return true if the value has been set to something. | |
Type const & | getType () const |
Return the type of the value stored. | |
int | size () const |
Return the size for string, base64, array, and struct values. | |
void | setSize (int size) |
Specify the size for array values. Array values will grow beyond this size if needed. | |
bool | hasMember (const std::string &name) const |
Check for the existence of a struct member by name. | |
bool | fromXml (std::string const &valueXml, int *offset) |
Decode xml. Destroys any existing value. | |
std::string | toXml () const |
Encode the Value in xml. | |
std::ostream & | write (std::ostream &os) const |
Write the value (no xml encoding) | |
Static Public Member Functions | |
static std::string const & | getDoubleFormat () |
Return the format used to write double values. | |
static void | setDoubleFormat (const char *f) |
Specify the format used to write double values. | |
Protected Member Functions | |
void | invalidate () |
void | assertTypeOrInvalid (Type t) |
void | assertArray (int size) const |
void | assertArray (int size) |
void | assertStruct () |
bool | boolFromXml (std::string const &valueXml, int *offset) |
bool | intFromXml (std::string const &valueXml, int *offset) |
bool | doubleFromXml (std::string const &valueXml, int *offset) |
bool | stringFromXml (std::string const &valueXml, int *offset) |
bool | timeFromXml (std::string const &valueXml, int *offset) |
bool | binaryFromXml (std::string const &valueXml, int *offset) |
bool | arrayFromXml (std::string const &valueXml, int *offset) |
bool | structFromXml (std::string const &valueXml, int *offset) |
std::string | boolToXml () const |
std::string | intToXml () const |
std::string | doubleToXml () const |
std::string | stringToXml () const |
std::string | timeToXml () const |
std::string | binaryToXml () const |
std::string | arrayToXml () const |
std::string | structToXml () const |
Protected Attributes | |
Type | _type |
union { | |
bool asBool | |
int asInt | |
double asDouble | |
struct tm * asTime | |
std::string * asString | |
BinaryData * asBinary | |
ValueArray * asArray | |
ValueStruct * asStruct | |
} | _value |
Static Protected Attributes | |
static std::string | _doubleFormat |
RPC method arguments and results are represented by Values.
Definition at line 22 of file XmlRpcValue.h.
typedef std::vector<char> XmlRpc::XmlRpcValue::BinaryData |
Definition at line 39 of file XmlRpcValue.h.
typedef std::vector<XmlRpcValue> XmlRpc::XmlRpcValue::ValueArray |
Definition at line 40 of file XmlRpcValue.h.
typedef std::map<std::string, XmlRpcValue> XmlRpc::XmlRpcValue::ValueStruct |
Definition at line 41 of file XmlRpcValue.h.
Enumerator | |
---|---|
TypeInvalid | |
TypeBoolean | |
TypeInt | |
TypeDouble | |
TypeString | |
TypeDateTime | |
TypeBase64 | |
TypeArray | |
TypeStruct |
Definition at line 26 of file XmlRpcValue.h.
|
inline |
Constructors.
Definition at line 45 of file XmlRpcValue.h.
Referenced by operator=().
|
inline |
Definition at line 46 of file XmlRpcValue.h.
|
inline |
Definition at line 47 of file XmlRpcValue.h.
|
inline |
Definition at line 48 of file XmlRpcValue.h.
|
inline |
Definition at line 50 of file XmlRpcValue.h.
|
inline |
Definition at line 53 of file XmlRpcValue.h.
|
inline |
Definition at line 56 of file XmlRpcValue.h.
|
inline |
Definition at line 60 of file XmlRpcValue.h.
|
inline |
Construct from xml, beginning at *offset chars into the string, updates offset.
Definition at line 66 of file XmlRpcValue.h.
|
inline |
|
inline |
Destructor (make virtual if you want to subclass)
Definition at line 73 of file XmlRpcValue.h.
|
protected |
Definition at line 459 of file XmlRpcValue.cpp.
Referenced by fromXml().
|
protected |
Definition at line 478 of file XmlRpcValue.cpp.
Referenced by toXml().
|
protected |
Definition at line 96 of file XmlRpcValue.cpp.
|
protected |
Definition at line 87 of file XmlRpcValue.cpp.
Referenced by operator[](), and setSize().
|
protected |
Definition at line 108 of file XmlRpcValue.cpp.
Referenced by operator[]().
|
protected |
Definition at line 69 of file XmlRpcValue.cpp.
Referenced by operator BinaryData &(), operator bool &(), operator double &(), operator int &(), operator std::string &(), and operator struct tm &().
|
protected |
Definition at line 417 of file XmlRpcValue.cpp.
Referenced by fromXml().
|
protected |
Definition at line 439 of file XmlRpcValue.cpp.
Referenced by toXml().
|
protected |
Definition at line 275 of file XmlRpcValue.cpp.
Referenced by fromXml().
|
protected |
Definition at line 289 of file XmlRpcValue.cpp.
Referenced by toXml().
|
inline |
Erase the current value.
Definition at line 76 of file XmlRpcValue.h.
Referenced by XmlRpc::XmlRpcClient::execute().
|
protected |
Definition at line 328 of file XmlRpcValue.cpp.
Referenced by fromXml().
|
protected |
Definition at line 342 of file XmlRpcValue.cpp.
Referenced by toXml().
bool XmlRpc::XmlRpcValue::fromXml | ( | std::string const & | valueXml, |
int * | offset | ||
) |
Decode xml. Destroys any existing value.
Definition at line 214 of file XmlRpcValue.cpp.
Referenced by XmlRpc::XmlRpcClient::parseResponse(), and XmlRpcValue().
|
inlinestatic |
Return the format used to write double values.
Definition at line 127 of file XmlRpcValue.h.
Referenced by doubleToXml().
|
inline |
Return the type of the value stored.
Definition at line 105 of file XmlRpcValue.h.
Referenced by XmlRpc::XmlRpcServerConnection::executeMulticall(), and XmlRpc::XmlRpcClient::generateRequest().
bool XmlRpc::XmlRpcValue::hasMember | ( | const std::string & | name | ) | const |
Check for the existence of a struct member by name.
Definition at line 207 of file XmlRpcValue.cpp.
|
protected |
Definition at line 300 of file XmlRpcValue.cpp.
Referenced by fromXml().
|
protected |
Definition at line 314 of file XmlRpcValue.cpp.
Referenced by toXml().
|
protected |
Definition at line 53 of file XmlRpcValue.cpp.
Referenced by clear(), fromXml(), operator=(), structFromXml(), and ~XmlRpcValue().
|
inline |
Definition at line 91 of file XmlRpcValue.h.
|
inline |
Definition at line 87 of file XmlRpcValue.h.
|
inline |
Definition at line 89 of file XmlRpcValue.h.
|
inline |
Definition at line 88 of file XmlRpcValue.h.
|
inline |
Definition at line 90 of file XmlRpcValue.h.
|
inline |
Definition at line 92 of file XmlRpcValue.h.
bool XmlRpc::XmlRpcValue::operator!= | ( | XmlRpcValue const & | other | ) | const |
Definition at line 186 of file XmlRpcValue.cpp.
|
inline |
Definition at line 82 of file XmlRpcValue.h.
Referenced by operator=().
|
inline |
|
inline |
XmlRpcValue & XmlRpc::XmlRpcValue::operator= | ( | XmlRpcValue const & | rhs | ) |
Definition at line 119 of file XmlRpcValue.cpp.
bool XmlRpc::XmlRpcValue::operator== | ( | XmlRpcValue const & | other | ) | const |
Definition at line 148 of file XmlRpcValue.cpp.
|
inline |
Definition at line 98 of file XmlRpcValue.h.
|
inline |
Definition at line 95 of file XmlRpcValue.h.
|
inline |
Definition at line 94 of file XmlRpcValue.h.
|
inline |
Definition at line 97 of file XmlRpcValue.h.
|
inlinestatic |
Specify the format used to write double values.
Definition at line 130 of file XmlRpcValue.h.
|
inline |
Specify the size for array values. Array values will grow beyond this size if needed.
Definition at line 111 of file XmlRpcValue.h.
Referenced by XmlRpc::XmlRpcServerConnection::executeMulticall(), XmlRpc::XmlRpcServer::listMethods(), testArray(), and testStruct().
int XmlRpc::XmlRpcValue::size | ( | ) | const |
Return the size for string, base64, array, and struct values.
Definition at line 193 of file XmlRpcValue.cpp.
Referenced by assertArray(), Sum::execute(), ArrayOfStructsTest::execute(), ModerateSizeArrayCheck::execute(), XmlRpc::XmlRpcServerConnection::executeMulticall(), XmlRpc::XmlRpcClient::generateRequest(), main(), and setSize().
|
protected |
Definition at line 357 of file XmlRpcValue.cpp.
Referenced by fromXml().
|
protected |
Definition at line 369 of file XmlRpcValue.cpp.
Referenced by toXml().
|
protected |
Definition at line 496 of file XmlRpcValue.cpp.
Referenced by fromXml().
|
protected |
Definition at line 521 of file XmlRpcValue.cpp.
Referenced by toXml().
|
protected |
Definition at line 380 of file XmlRpcValue.cpp.
Referenced by fromXml().
|
protected |
Definition at line 399 of file XmlRpcValue.cpp.
Referenced by toXml().
std::string XmlRpc::XmlRpcValue::toXml | ( | ) | const |
Encode the Value in xml.
Definition at line 257 of file XmlRpcValue.cpp.
Referenced by XmlRpc::XmlRpcServerConnection::executeRequest(), XmlRpc::XmlRpcServerConnection::generateFaultResponse(), XmlRpc::XmlRpcClient::generateRequest(), and testString().
|
inline |
Return true if the value has been set to something.
Definition at line 102 of file XmlRpcValue.h.
Referenced by XmlRpc::XmlRpcServerConnection::executeMethod(), XmlRpc::XmlRpcClient::generateRequest(), XmlRpc::XmlRpcClient::parseResponse(), and structFromXml().
std::ostream & XmlRpc::XmlRpcValue::write | ( | std::ostream & | os | ) | const |
Write the value (no xml encoding)
Definition at line 544 of file XmlRpcValue.cpp.
|
staticprotected |
Definition at line 164 of file XmlRpcValue.h.
Referenced by getDoubleFormat(), and setDoubleFormat().
|
protected |
Definition at line 167 of file XmlRpcValue.h.
Referenced by arrayFromXml(), assertArray(), assertStruct(), assertTypeOrInvalid(), binaryFromXml(), boolFromXml(), doubleFromXml(), getType(), hasMember(), intFromXml(), invalidate(), operator=(), operator==(), size(), stringFromXml(), structFromXml(), timeFromXml(), toXml(), valid(), write(), and XmlRpcValue().
union { ... } XmlRpc::XmlRpcValue::_value |
Referenced by arrayFromXml(), arrayToXml(), assertArray(), assertStruct(), assertTypeOrInvalid(), binaryFromXml(), binaryToXml(), boolFromXml(), boolToXml(), doubleFromXml(), doubleToXml(), hasMember(), intFromXml(), intToXml(), invalidate(), operator BinaryData &(), operator bool &(), operator double &(), operator int &(), operator std::string &(), operator struct tm &(), operator=(), operator==(), operator[](), size(), stringFromXml(), stringToXml(), structFromXml(), structToXml(), timeFromXml(), timeToXml(), write(), and XmlRpcValue().
ValueArray* XmlRpc::XmlRpcValue::asArray |
Definition at line 178 of file XmlRpcValue.h.
Referenced by operator=().
BinaryData* XmlRpc::XmlRpcValue::asBinary |
Definition at line 177 of file XmlRpcValue.h.
Referenced by operator=().
bool XmlRpc::XmlRpcValue::asBool |
Definition at line 172 of file XmlRpcValue.h.
Referenced by operator=().
double XmlRpc::XmlRpcValue::asDouble |
Definition at line 174 of file XmlRpcValue.h.
Referenced by operator=().
int XmlRpc::XmlRpcValue::asInt |
Definition at line 173 of file XmlRpcValue.h.
Referenced by operator=().
std::string* XmlRpc::XmlRpcValue::asString |
Definition at line 176 of file XmlRpcValue.h.
Referenced by binaryFromXml(), and operator=().
ValueStruct* XmlRpc::XmlRpcValue::asStruct |
Definition at line 179 of file XmlRpcValue.h.
Referenced by operator=().
struct tm* XmlRpc::XmlRpcValue::asTime |
Definition at line 175 of file XmlRpcValue.h.
Referenced by operator=().