7#include "XmlRpcValue.h"
14using YarpXmlRpc::XmlRpcValue;
20 case XmlRpcValue::TypeInt:
23 case XmlRpcValue::TypeDouble:
24 return Value((
double)v);
26 case XmlRpcValue::TypeString:
28 std::string s = (std::string)v;
29 if (s.length()==0 || s[0]!=
'[') {
38 case XmlRpcValue::TypeArray:
42 for (
int i=0;
i<v.size();
i++) {
43 XmlRpcValue&
v2 = v[
i];
44 if (
v2.
getType()!=XmlRpcValue::TypeInvalid) {
48 if (tag==
"list"||tag==
"dict") {
60 case XmlRpcValue::TypeStruct:
64 XmlRpcValue::ValueStruct&
vals = v;
66 for (
auto& val :
vals) {
67 XmlRpcValue&
v2 = val.second;
69 sub.addString(val.first.c_str());
70 if (
v2.
getType()!=XmlRpcValue::TypeInvalid) {
77 case XmlRpcValue::TypeInvalid:
82 return Value(
"(type not supported yet out of laziness)");
104 client.read(
"POST /RP");
106 server.read(
"POST /RP");
111 Bytes bytes(buf,
sizeof(buf));
135 if (
cprefix==
"publisherUpdate") {
157 sis.
reset(prefix +
"\n");
160 result = sis.
read(b);
166 return (result>0)?result:-1;
const yarp::os::LogComponent & XMLRPCCARRIER()
Value toValue(XmlRpcValue &v, bool outer)
void write(const yarp::os::Bytes &b) override
Write a block of bytes to the stream.
A simple collection of objects that can be described and transmitted in a portable way.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
A mini-server for performing network communication in the background.
Type getType() override
Get the type of data the port has committed to send/receive.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
A simple abstraction for a block of bytes.
virtual InputStream & getInputStream()=0
Get an InputStream to read from.
virtual OutputStream & getOutputStream()=0
Get an OutputStream to write to.
A single value (typically within a Bottle).
static Value & getNullValue()
Return an invalid, "null" Value.
std::string toString() const override
Return a standard text representation of the content of the object.
bool isNull() const override
Checks if the object is invalid.
void fromString(const char *str)
Set value to correspond to a textual representation.
virtual std::string asString() const
Get string value.
#define yCTrace(component,...)
An interface to the operating system, including Port based communication.