1 // ---------------------------------------------------------------------------- 2 // 3 // flxmlrpc Copyright (c) 2015 by W1HKJ, Dave Freese <iam_w1hkj@w1hkj.com> 4 // 5 // XmlRpc++ Copyright (c) 2002-2008 by Chris Morley 6 // 7 // This file is part of fldigi 8 // 9 // flxmlrpc is free software; you can redistribute it and/or modify 10 // it under the terms of the GNU Lesser General Public License as published by 11 // the Free Software Foundation; either version 3 of the License, or 12 // (at your option) any later version. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program. If not, see <http://www.gnu.org/licenses/>. 16 // ---------------------------------------------------------------------------- 17 18 #ifndef _XMLRPC_H_ 19 #define _XMLRPC_H_ 20 21 #if defined(_MSC_VER) 22 # pragma warning(disable:4786) // identifier was truncated in debug info 23 #endif 24 25 26 #include <string> 27 28 #include "XmlRpcClient.h" 29 #include "XmlRpcException.h" 30 #include "XmlRpcServer.h" 31 #include "XmlRpcServerMethod.h" 32 #include "XmlRpcValue.h" 33 #include "XmlRpcUtil.h" 34 35 namespace XmlRpc { 36 37 38 //! An interface allowing custom handling of error message reporting. 39 class XmlRpcErrorHandler { 40 public: 41 XmlRpcErrorHandler()42 XmlRpcErrorHandler() {} ~XmlRpcErrorHandler()43 virtual ~XmlRpcErrorHandler() {} 44 45 //! Returns a pointer to the currently installed error handling object. getErrorHandler()46 static XmlRpcErrorHandler* getErrorHandler() 47 { return _errorHandler; } 48 49 //! Specifies the error handler. setErrorHandler(XmlRpcErrorHandler * eh)50 static void setErrorHandler(XmlRpcErrorHandler* eh) 51 { _errorHandler = eh; } 52 53 //! Report an error. Custom error handlers should define this method. 54 virtual void error(const char* msg) = 0; 55 56 protected: 57 static XmlRpcErrorHandler* _errorHandler; 58 }; 59 60 //! An interface allowing custom handling of informational message reporting. 61 class XmlRpcLogHandler { 62 public: XmlRpcLogHandler()63 XmlRpcLogHandler() {} ~XmlRpcLogHandler()64 virtual ~XmlRpcLogHandler() {} 65 66 //! Returns a pointer to the currently installed message reporting object. getLogHandler()67 static XmlRpcLogHandler* getLogHandler() 68 { return _logHandler; } 69 70 //! Specifies the message handler. setLogHandler(XmlRpcLogHandler * lh)71 static void setLogHandler(XmlRpcLogHandler* lh) 72 { _logHandler = lh; } 73 74 //! Returns the level of verbosity of informational messages. 0 is no output, 5 is very verbose. getVerbosity()75 static int getVerbosity() 76 { return _verbosity; } 77 78 //! Specify the level of verbosity of informational messages. 0 is no output, 5 is very verbose. setVerbosity(int v)79 static void setVerbosity(int v) 80 { _verbosity = v; } 81 82 //! Output a message. Custom error handlers should define this method. 83 virtual void log(int level, const char* msg) = 0; 84 85 protected: 86 static XmlRpcLogHandler* _logHandler; 87 static int _verbosity; 88 }; 89 90 //! Returns log message verbosity. This is short for XmlRpcLogHandler::getVerbosity() 91 int getVerbosity(); 92 //! Sets log message verbosity. This is short for XmlRpcLogHandler::setVerbosity(level) 93 void setVerbosity(int level); 94 95 96 //! Version identifier 97 extern const char XMLRPC_VERSION[]; 98 99 } // namespace XmlRpc 100 101 #endif // _XMLRPC_H_ 102