40{
41public:
43
45 {
46 std::cerr << "CountTheEntities\n";
47 std::string&
arg = params[0];
48 int ctLeftAngleBrackets = 0;
49 int ctRightAngleBrackets = 0;
50 int ctAmpersands = 0;
51 int ctApostrophes = 0;
52 int ctQuotes = 0;
53
54 int n = int(
arg.length());
55 for (
int i=0; i<
n; ++i)
57 {
58 case '<': ++ctLeftAngleBrackets; break;
59 case '>': ++ctRightAngleBrackets; break;
60 case '&': ++ctAmpersands; break;
61 case '\'': ++ctApostrophes; break;
62 case '\"': ++ctQuotes; break;
63 }
64
65 result["ctLeftAngleBrackets"] = ctLeftAngleBrackets;
66 result["ctRightAngleBrackets"] = ctRightAngleBrackets;
67 result["ctAmpersands"] = ctAmpersands;
68 result["ctApostrophes"] = ctApostrophes;
69 result["ctQuotes"] = ctQuotes;
70 }
71} countTheEntities(&
s);
72
73
74
75
76
77
78
80{
81public:
83
85 {
86 std::cerr << "EasyStructTest\n";
88 int sum = int(arg1["moe"]) + int(arg1["larry"]) + int(arg1["curly"]);
89 result = sum;
90 }
92
93
94
95
97{
98public:
100
102 {
103 std::cerr << "EchoStructTest\n";
104 result = params[0];
105 }
107
108
109
110
111
113{
114public:
116
118 {
119 std::cerr << "ManyTypesTest\n";
120 result = params;
121 }
123
124
125
126
127
128
129
130
132{
133public:
135
137 {
138 std::cerr << "ModerateSizeArrayCheck\n";
139 std::string
s = params[0][0];
140 s += params[0][params[0].
size()-1];
142 }
143} moderateSizeArrayCheck(&
s);
144
145
146
147
148
149
150
151
152
154{
155public:
157
159 {
160 std::cerr << "NestedStructTest\n";
161 XmlRpcValue& dayStruct = params[0][
"2000"][
"04"][
"01"];
162 int sum = int(dayStruct["moe"]) + int(dayStruct["larry"]) + int(dayStruct["curly"]);
163 result = sum;
164 }
165} nestedStructTest(&
s);
166
167
168
169
170
171
173{
174public:
176
178 {
179 std::cerr << "SimpleStructReturnTest\n";
181 result[
"times10"] =
n * 10;
182 result[
"times100"] =
n * 100;
183 result[
"times1000"] =
n * 1000;
184 }
185} simpleStructReturnTest(&
s);
186
187
188
189int main(
int argc,
char* argv[])
190{
191 if (argc != 2) {
192 std::cerr << "Usage: Validator port\n";
193 return -1;
194 }
195 int port = atoi(argv[1]);
196
198
199
201
202
204
205 return 0;
206}
207
double arg(const EvtComplex &c)
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
CountTheEntities(XmlRpcServer *s)
EasyStructTest(XmlRpcServer *s)
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
EchoStructTest(XmlRpcServer *s)
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
ManyTypesTest(XmlRpcServer *s)
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
ModerateSizeArrayCheck(XmlRpcServer *s)
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
NestedStructTest(XmlRpcServer *s)
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
SimpleStructReturnTest(XmlRpcServer *s)
Abstract class representing a single RPC method.
A class to handle XML RPC requests.
bool bindAndListen(int port, int backlog=5)
void work(double msTime)
Process client requests for the specified time.
RPC method arguments and results are represented by Values.
int size() const
Return the size for string, base64, array, and struct values.
void setVerbosity(int level)
Sets log message verbosity. This is short for XmlRpcLogHandler::setVerbosity(level)