Menu

[r3316]: / advanced / src / cpp / libwww.cpp  Maximize  Restore  History

Download this file

160 lines (104 with data), 3.5 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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*=============================================================================
libwww.cpp
===============================================================================
This is the Libwww XML transport of the C++ XML-RPC client library for
Xmlrpc-c.
=============================================================================*/
#include <stdlib.h>
#include <cassert>
#include <string>
#include "xmlrpc-c/girerr.hpp"
using girerr::error;
using girerr::throwf;
#include "xmlrpc-c/girmem.hpp"
using girmem::autoObjectPtr;
using girmem::autoObject;
#include "xmlrpc-c/env_wrap.hpp"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/client.h"
#include "xmlrpc-c/transport.h"
#include "xmlrpc-c/base_int.h"
/* transport_config.h defines MUST_BUILD_LIBWWW_CLIENT */
#include "transport_config.h"
#include "xmlrpc-c/client_transport.hpp"
using namespace std;
using namespace xmlrpc_c;
namespace {
class globalConstant {
public:
globalConstant();
~globalConstant();
};
globalConstant::globalConstant() {
// Not thread safe
xmlrpc_transport_setup setupFn;
#if MUST_BUILD_LIBWWW_CLIENT
setupFn = xmlrpc_libwww_transport_ops.setup_global_const;
#else
setupFn = NULL;
#endif
if (setupFn) {
env_wrap env;
setupFn(&env.env_c); // Not thread safe
if (env.env_c.fault_occurred)
throwf("Failed to do global initialization "
"of Libwww transport code. %s", env.env_c.fault_string);
}
}
globalConstant::~globalConstant() {
// Not thread safe
xmlrpc_transport_teardown teardownFn;
#if MUST_BUILD_LIBWWW_CLIENT
teardownFn = xmlrpc_libwww_transport_ops.teardown_global_const;
#else
teardownFn = NULL;
#endif
if (teardownFn)
teardownFn(); // not thread safe
}
globalConstant globalConst;
// This object is never accessed. Its whole purpose to to be born and
// to die, which it does automatically as part of C++ program
// program initialization and termination.
} // namespace
namespace xmlrpc_c {
carriageParm_libwww0::carriageParm_libwww0(
string const serverUrl
) {
this->instantiate(serverUrl);
}
carriageParm_libwww0Ptr::carriageParm_libwww0Ptr() {
// Base class constructor will construct pointer that points to nothing
}
carriageParm_libwww0Ptr::carriageParm_libwww0Ptr(
carriageParm_libwww0 * const carriageParmP) {
this->point(carriageParmP);
}
carriageParm_libwww0 *
carriageParm_libwww0Ptr::operator->() const {
autoObject * const p(this->objectP);
return dynamic_cast<carriageParm_libwww0 *>(p);
}
#if MUST_BUILD_LIBWWW_CLIENT
clientXmlTransport_libwww::clientXmlTransport_libwww(
string const appname,
string const appversion) {
this->c_transportOpsP = &xmlrpc_libwww_transport_ops;
env_wrap env;
xmlrpc_libwww_transport_ops.create(
&env.env_c, 0, appname.c_str(), appversion.c_str(), NULL, 0,
&this->c_transportP);
if (env.env_c.fault_occurred)
throw(error(env.env_c.fault_string));
}
#else // MUST_BUILD_LIBWWW_CLIENT
clientXmlTransport_libwww::clientXmlTransport_libwww(string const,
string const) {
throw(error("There is no Libwww client XML transport "
"in this XML-RPC client library"));
}
#endif
clientXmlTransport_libwww::~clientXmlTransport_libwww() {
this->c_transportOpsP->destroy(this->c_transportP);
}
} // namespace
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.