Home | History | Annotate | Download | only in src
      1 #ifndef _XMLRPC_H_
      2 #define _XMLRPC_H_
      3 //
      4 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
      5 // This library is free software; you can redistribute it and/or
      6 // modify it under the terms of the GNU Lesser General Public
      7 // License as published by the Free Software Foundation; either
      8 // version 2.1 of the License, or (at your option) any later version.
      9 //
     10 // This library is distributed in the hope that it will be useful,
     11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13 // Lesser General Public License for more details.
     14 //
     15 // You should have received a copy of the GNU Lesser General Public
     16 // License along with this library; if not, write to the Free Software
     17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
     18 //
     19 
     20 #if defined(_MSC_VER)
     21 # pragma warning(disable:4786)    // identifier was truncated in debug info
     22 #endif
     23 
     24 #ifndef MAKEDEPEND
     25 # include <string>
     26 #endif
     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     //! Returns a pointer to the currently installed error handling object.
     42     static XmlRpcErrorHandler* getErrorHandler()
     43     { return _errorHandler; }
     44 
     45     //! Specifies the error handler.
     46     static void setErrorHandler(XmlRpcErrorHandler* eh)
     47     { _errorHandler = eh; }
     48 
     49     //! Report an error. Custom error handlers should define this method.
     50     virtual void error(const char* msg) = 0;
     51 
     52     virtual ~XmlRpcErrorHandler() {}
     53   protected:
     54     static XmlRpcErrorHandler* _errorHandler;
     55   };
     56 
     57   //! An interface allowing custom handling of informational message reporting.
     58   class XmlRpcLogHandler {
     59   public:
     60     //! Returns a pointer to the currently installed message reporting object.
     61     static XmlRpcLogHandler* getLogHandler()
     62     { return _logHandler; }
     63 
     64     //! Specifies the message handler.
     65     static void setLogHandler(XmlRpcLogHandler* lh)
     66     { _logHandler = lh; }
     67 
     68     //! Returns the level of verbosity of informational messages. 0 is no output, 5 is very verbose.
     69     static int getVerbosity()
     70     { return _verbosity; }
     71 
     72     //! Specify the level of verbosity of informational messages. 0 is no output, 5 is very verbose.
     73     static void setVerbosity(int v)
     74     { _verbosity = v; }
     75 
     76     //! Output a message. Custom error handlers should define this method.
     77     virtual void log(int level, const char* msg) = 0;
     78 
     79     virtual ~XmlRpcLogHandler() {}
     80   protected:
     81     static XmlRpcLogHandler* _logHandler;
     82     static int _verbosity;
     83   };
     84 
     85   //! Returns log message verbosity. This is short for XmlRpcLogHandler::getVerbosity()
     86   int getVerbosity();
     87   //! Sets log message verbosity. This is short for XmlRpcLogHandler::setVerbosity(level)
     88   void setVerbosity(int level);
     89 
     90 
     91   //! Version identifier
     92   extern const char XMLRPC_VERSION[];
     93 
     94 } // namespace XmlRpc
     95 
     96 #endif // _XMLRPC_H_
     97