Menu

[r1322]: / advanced / tools / xml-rpc-api2cpp / XmlRpcClass.cpp  Maximize  Restore  History

Download this file

85 lines (56 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <iostream>
#include <stdexcept>
#include <vector>
using namespace std;
#include "xmlrpc-c/oldcppwrapper.hpp"
#include "DataType.hpp"
#include "XmlRpcFunction.hpp"
#include "XmlRpcClass.hpp"
XmlRpcClass::XmlRpcClass(string const& className) :
mClassName(className) {}
XmlRpcClass::XmlRpcClass(XmlRpcClass const& c) :
mClassName(c.mClassName),
mFunctions(c.mFunctions) {}
XmlRpcClass&
XmlRpcClass::operator= (XmlRpcClass const& c) {
if (this != &c) {
this->mClassName = c.mClassName;
this->mFunctions = c.mFunctions;
}
return *this;
}
void
XmlRpcClass::addFunction(XmlRpcFunction const& function) {
mFunctions.push_back(function);
}
void
XmlRpcClass::printDeclaration(ostream & out) const {
out << "class " << mClassName << " {" << endl;
out << " XmlRpcClient mClient;" << endl;
out << endl;
out << "public:" << endl;
out << " " << mClassName << " (const XmlRpcClient& client)" << endl;
out << " : mClient(client) {}" << endl;
out << " " << mClassName << " (const std::string& server_url)" << endl;
out << " : mClient(XmlRpcClient(server_url)) {}" << endl;
out << " " << mClassName << " (const " << mClassName << "& o)" << endl;
out << " : mClient(o.mClient) {}" << endl;
out << endl;
out << " " << mClassName << "& operator= (const "
<< mClassName << "& o) {" << endl;
out << " if (this != &o) mClient = o.mClient;" << endl;
out << " return *this;" << endl;
out << " }" << endl;
vector<XmlRpcFunction>::const_iterator f;
for (f = mFunctions.begin(); f < mFunctions.end(); ++f) {
f->printDeclarations(out);
}
out << "};" << endl;
}
void
XmlRpcClass::printDefinition(ostream & out) const {
vector<XmlRpcFunction>::const_iterator f;
for (f = mFunctions.begin(); f < mFunctions.end(); ++f) {
f->printDefinitions(out, mClassName);
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.