From 922cb5559b9f2f97279fa24cc9c5862c8b666495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 8 Mar 2005 10:23:43 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2603, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/iem/iemxmlrpc/; revision=2604 --- xmlrpc++/src/XmlRpcUtil.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 xmlrpc++/src/XmlRpcUtil.h (limited to 'xmlrpc++/src/XmlRpcUtil.h') diff --git a/xmlrpc++/src/XmlRpcUtil.h b/xmlrpc++/src/XmlRpcUtil.h new file mode 100644 index 0000000..8128f72 --- /dev/null +++ b/xmlrpc++/src/XmlRpcUtil.h @@ -0,0 +1,61 @@ +#ifndef _XMLRPCUTIL_H_ +#define _XMLRPCUTIL_H_ +// +// XmlRpc++ Copyright (c) 2002-2003 by Chris Morley +// +#if defined(_MSC_VER) +# pragma warning(disable:4786) // identifier was truncated in debug info +#endif + +#ifndef MAKEDEPEND +# include +#endif + +#if defined(_MSC_VER) +# define snprintf _snprintf +# define vsnprintf _vsnprintf +# define strcasecmp _stricmp +# define strncasecmp _strnicmp +#elif defined(__BORLANDC__) +# define strcasecmp stricmp +# define strncasecmp strnicmp +#endif + +namespace XmlRpc { + + //! Utilities for XML parsing, encoding, and decoding and message handlers. + class XmlRpcUtil { + public: + // hokey xml parsing + //! Returns contents between and , updates offset to char after + static std::string parseTag(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 bool findTag(const char* tag, std::string const& xml, int* offset); + + //! Returns the next tag and updates offset to the char after the tag, or empty string + //! if the next non-whitespace character is not '<' + static std::string getNextTag(std::string const& xml, int* offset); + + //! Returns true if the tag is found at the specified offset (modulo any whitespace) + //! and updates offset to the char after the tag + static bool nextTagIs(const char* tag, std::string const& xml, int* offset); + + + //! Convert raw text to encoded xml. + static std::string xmlEncode(const std::string& raw); + + //! Convert encoded xml to raw text + static std::string xmlDecode(const std::string& encoded); + + + //! Dump messages somewhere + static void log(int level, const char* fmt, ...); + + //! Dump error messages somewhere + static void error(const char* fmt, ...); + + }; +} // namespace XmlRpc + +#endif // _XMLRPCUTIL_H_ -- cgit v1.2.1