BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
XmlRpcUtil.h
Go to the documentation of this file.
1#ifndef _XMLRPCUTIL_H_
2#define _XMLRPCUTIL_H_
3//
4// XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
5//
6#if defined( _MSC_VER )
7# pragma warning( disable : 4786 ) // identifier was truncated in debug info
8#endif
9
10#ifndef MAKEDEPEND
11# include <string>
12#endif
13
14#if defined( _MSC_VER )
15# define snprintf _snprintf
16# define vsnprintf _vsnprintf
17# define strcasecmp _stricmp
18# define strncasecmp _strnicmp
19#elif defined( __BORLANDC__ )
20# define strcasecmp stricmp
21# define strncasecmp strnicmp
22#endif
23
24namespace XmlRpc {
25
26 //! Utilities for XML parsing, encoding, and decoding and message handlers.
27 class XmlRpcUtil {
28 public:
29 // hokey xml parsing
30 //! Returns contents between <tag> and </tag>, updates offset to char after </tag>
31 static std::string parseTag( const char* tag, std::string const& xml, int* offset );
32
33 //! Returns true if the tag is found and updates offset to the char after the tag
34 static bool findTag( const char* tag, std::string const& xml, int* offset );
35
36 //! Returns the next tag and updates offset to the char after the tag, or empty string
37 //! if the next non-whitespace character is not '<'
38 static std::string getNextTag( std::string const& xml, int* offset );
39
40 //! Returns true if the tag is found at the specified offset (modulo any whitespace)
41 //! and updates offset to the char after the tag
42 static bool nextTagIs( const char* tag, std::string const& xml, int* offset );
43
44 //! Convert raw text to encoded xml.
45 static std::string xmlEncode( const std::string& raw );
46
47 //! Convert encoded xml to raw text
48 static std::string xmlDecode( const std::string& encoded );
49
50 //! Dump messages somewhere
51 static void log( int level, const char* fmt, ... );
52
53 //! Dump error messages somewhere
54 static void error( const char* fmt, ... );
55 };
56} // namespace XmlRpc
57
58#endif // _XMLRPCUTIL_H_
Utilities for XML parsing, encoding, and decoding and message handlers.
Definition XmlRpcUtil.h:27
static bool nextTagIs(const char *tag, std::string const &xml, int *offset)
static std::string parseTag(const char *tag, std::string const &xml, int *offset)
Returns contents between <tag> and </tag>, updates offset to char after </tag>.
static void error(const char *fmt,...)
Dump error messages somewhere.
static std::string xmlEncode(const std::string &raw)
Convert raw text to encoded xml.
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 void log(int level, const char *fmt,...)
Dump messages somewhere.
static std::string getNextTag(std::string const &xml, int *offset)
static std::string xmlDecode(const std::string &encoded)
Convert encoded xml to raw text.