20 XmlRpcValue booleanFalseXml(
"<value><boolean>0</boolean></value>", &offset);
22 XmlRpcValue booleanTrueXml(
"<value><boolean>1</boolean></value>", &offset);
23 assert(booleanFalse != booleanTrue);
24 assert(booleanFalse == booleanFalseXml);
25 assert(booleanFalse != booleanTrueXml);
27 if (
bool(booleanFalse))
30 if ( !
bool(booleanTrue))
42 XmlRpcValue int0Xml(
"<value><int>0</int></value>", &offset);
44 XmlRpcValue int9Xml(
"<value><i4>9</i4></value>", &offset);
45 assert(int0 == int0Xml);
46 assert(
int(int10) -
int(int1) ==
int(int9Xml));
47 assert(9 ==
int(int9Xml));
48 assert(
int(int10) +
int(int_1) ==
int(int9Xml));
56 XmlRpcValue dXml(
"<value><double>56.3</double></value>", &offset);
57 assert(
double(d) +
double(dXml) == 100.0);
64 char csxml[] =
"<value><string>Now is the time <&</string></value>";
65 std::string ssxml = csxml;
77 std::string emptyStringXml(
"<value></value>");
79 XmlRpcValue emptyStringVal1(emptyStringXml, &offset);
81 assert(emptyStringVal1 == emptyStringVal2);
83 emptyStringXml =
"<value> </value>";
85 XmlRpcValue blankStringVal(emptyStringXml, &offset);
86 assert(std::string(blankStringVal) ==
" ");
94 XmlRpcValue dateTime(
"<value><dateTime.iso8601>19040101T03:12:35</dateTime.iso8601></value>", &offset);
95 struct tm &t = dateTime;
96 assert(t.tm_year == 1904 && t.tm_min == 12);
106 a[1] = std::string(
"two");
109 assert(
int(a[0]) == 1);
115 " <value><i4>1</i4></value> \n" 116 " <value> <string>two</string></value>\n" 117 " <value><double>43.7</double></value>\n" 118 " <value>four</value>\n" 132 struct1[
"str"] =
"two";
138 a[1] = std::string(
"two");
142 assert(struct1[
"d"] == a[2]);
147 " <name>i4</name> \n" 148 " <value><i4>1</i4></value> \n" 152 " <value><double>43.7</double></value>\n" 155 " <name>str</name> \n" 156 " <value> <string>two</string></value>\n" 162 assert(struct1 == structXml);
165 astruct[
"array"] = a;
166 assert(astruct[
"array"][2] == struct1[
"d"]);
168 for (
int i=0; i<10; i++) {
170 Event[
"Name"] =
"string";
174 const int NELMTS = 100;
177 for (ii=0; ii< NELMTS; ++ii) {
179 sprintf(buf,
"%d", ii);
180 Event[std::string(buf)] = buf;
185 for (ii=0; ii< NELMTS; ++ii) {
187 sprintf(buf,
"%d", ii);
189 Event[std::string(buf)] = ii;
191 for (
int jj=0; jj< NELMTS; ++jj) {
193 sprintf(bufj,
"%d", jj);
194 Event[std::string(buf)][std::string(bufj)] = bufj;
198 for (ii=0; ii< NELMTS; ++ii) {
200 sprintf(buf,
"%d", ii);
202 assert(Event[std::string(buf)] ==
XmlRpcValue(ii));
204 assert(Event[std::string(buf)].size() == NELMTS);
211 int main(
int argc,
char* argv[])
RPC method arguments and results are represented by Values.
void testArray(XmlRpcValue const &d)
void clear()
Erase the current value.
void setSize(int size)
Specify the size for array values. Array values will grow beyond this size if needed.
int main(int argc, char *argv[])
std::string toXml() const
Encode the Value in xml.
XmlRpcValue fromXml(std::string const &data)