Go to the documentation of this file.
19 #ifdef USE_WINDOWS_DEBUG
20 #define WIN32_LEAN_AND_MEAN
34 void log(
int level,
const char* msg) {
35 #ifdef USE_WINDOWS_DEBUG
36 if (level <= _verbosity) { OutputDebugString(msg); OutputDebugString(
"\n"); }
38 if (level <= _verbosity) std::cout << msg << std::endl;
52 #ifdef USE_WINDOWS_DEBUG
53 void error(
const char* msg) {
54 OutputDebugString(msg); OutputDebugString(
"\n");
89 std::vsnprintf(buf,
sizeof(buf)-1,fmt,va);
91 buf[
sizeof(buf)-1] = 0;
102 std::vsnprintf(buf,
sizeof(buf)-1,fmt,va);
104 buf[
sizeof(buf)-1] = 0;
115 if (offset == NULL)
return std::string();
117 if (xml.length() >
size_t(INT_MAX))
return std::string();
118 if (*offset >=
int(xml.length()))
return std::string();
119 size_t istart = xml.find(tag, *offset);
120 if (istart == std::string::npos)
return std::string();
121 istart += strlen(tag);
122 std::string etag =
"</";
124 size_t iend = xml.find(etag, istart);
125 if (iend == std::string::npos)
return std::string();
127 *offset = int(iend + etag.length());
128 return xml.substr(istart, iend-istart);
136 if (offset == NULL)
return false;
137 if (xml.length() >
size_t(INT_MAX))
return false;
138 if (*offset >=
int(xml.length()))
return false;
139 size_t istart = xml.find(tag, *offset);
140 if (istart == std::string::npos)
143 *offset = int(istart + strlen(tag));
153 if (offset == NULL)
return false;
154 if (xml.length() >
size_t(INT_MAX))
return false;
155 if (*offset >=
int(xml.length()))
return false;
156 const char* cp = xml.c_str() + *offset;
158 while (*cp && isspace(*cp)) {
163 int len = int(strlen(tag));
164 if (*cp && (strncmp(cp, tag, len) == 0)) {
176 if (offset == NULL)
return std::string();
177 if (xml.length() >
size_t(INT_MAX))
return std::string();
178 if (*offset >=
int(xml.length()))
return std::string();
180 const char* start_cp = xml.c_str() + *offset;
181 const char* cp = start_cp;
182 while (*cp && isspace(*cp)) {
186 const int len = int(strnlen(tag, xml.length()));
188 if (!(*cp) || (strncmp(cp, tag, len) != 0)) {
189 return std::string();
205 return std::string();
209 std::string etag =
"</";
212 if (strncmp(cp, etag.c_str(), etag.length()) != 0) {
213 return std::string();
218 *offset += (cp - start_cp);
228 if (offset == NULL)
return std::string();
229 if (xml.length() >
size_t(INT_MAX))
return std::string();
230 if (*offset >=
int(xml.length()))
return std::string();
232 size_t pos = *offset;
233 const char* cp = xml.c_str() + pos;
234 while (*cp && isspace(*cp)) {
239 if (*cp !=
'<')
return std::string();
245 }
while (*cp++ !=
'>' && *cp != 0);
254 static const char AMP =
'&';
255 static const char rawEntity[] = {
'<',
'>',
'&',
'\'',
'\"', 0 };
256 static const char*
xmlEntity[] = {
"lt;",
"gt;",
"amp;",
"apos;",
"quot;", 0 };
265 std::string::size_type iAmp = encoded.find(
AMP);
266 if (iAmp == std::string::npos)
269 std::string decoded(encoded, 0, iAmp);
270 std::string::size_type iSize = encoded.size();
271 decoded.reserve(iSize);
273 const char* ens = encoded.c_str();
274 while (iAmp != iSize) {
275 if (encoded[iAmp] ==
AMP && iAmp+1 < iSize) {
277 for (iEntity=0;
xmlEntity[iEntity] != 0; ++iEntity)
286 decoded += encoded[iAmp++];
289 decoded += encoded[iAmp++];
302 std::string::size_type iRep = raw.find_first_of(
rawEntity);
303 if (iRep == std::string::npos)
306 std::string encoded(raw, 0, iRep);
307 std::string::size_type iSize = raw.size();
309 while (iRep != iSize) {
311 for (iEntity=0;
rawEntity[iEntity] != 0; ++iEntity)
319 encoded += raw[iRep];
XMLRPCPP_DECL void setVerbosity(int level)
Sets log message verbosity. This is short for XmlRpcLogHandler::setVerbosity(level)
DefaultErrorHandler defaultErrorHandler
An interface allowing custom handling of informational message reporting.
void error(const char *msg)
Report an error. Custom error handlers should define this method.
static std::string xmlEncode(const std::string &raw)
Convert raw text to encoded xml.
void log(int level, const char *msg)
Output a message. Custom error handlers should define this method.
static void log(int level, const char *fmt,...)
Dump messages somewhere.
XMLRPCPP_DECL int getVerbosity()
Returns log message verbosity. This is short for XmlRpcLogHandler::getVerbosity()
static XmlRpcLogHandler * getLogHandler()
Returns a pointer to the currently installed message reporting object.
static const int xmlEntLen[]
static std::string parseTag(const char *tag, std::string const &xml, int *offset)
static bool findTag(const char *tag, std::string const &xml, int *offset)
Returns true if the tag is found and updates offset to the char after the tag.
static const char * xmlEntity[]
static void setVerbosity(int v)
Specify the level of verbosity of informational messages. 0 is no output, 5 is very verbose.
static XMLRPCPP_DECL XmlRpcErrorHandler * _errorHandler
static std::string nextTagData(const char *tag, std::string const &xml, int *offset)
virtual void error(const char *msg)=0
Report an error. Custom error handlers should define this method.
An interface allowing custom handling of error message reporting.
static bool nextTagIs(const char *tag, std::string const &xml, int *offset)
static void error(const char *fmt,...)
Dump error messages somewhere.
static std::string xmlDecode(const std::string &encoded)
Convert encoded xml to raw text.
static const char rawEntity[]
DefaultLogHandler defaultLogHandler
static XMLRPCPP_DECL int _verbosity
const XMLRPCPP_DECL char XMLRPC_VERSION[]
Version identifier.
static XmlRpcErrorHandler * getErrorHandler()
Returns a pointer to the currently installed error handling object.
static XMLRPCPP_DECL XmlRpcLogHandler * _logHandler
virtual void log(int level, const char *msg)=0
Output a message. Custom error handlers should define this method.
static std::string getNextTag(std::string const &xml, int *offset)
static int getVerbosity()
Returns the level of verbosity of informational messages. 0 is no output, 5 is very verbose.
xmlrpcpp
Author(s): Chris Morley, Konstantin Pilipchuk, Morgan Quigley, Austin Hendrix, Dirk Thomas
, Jacob Perron
autogenerated on Sat Apr 26 2025 02:59:11