• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #ifndef _XMLRPCSERVERMETHOD_H_
3 #define _XMLRPCSERVERMETHOD_H_
4 //
5 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
6 //
7 #if defined(_MSC_VER)
8 # pragma warning(disable:4786)    // identifier was truncated in debug info
9 #endif
10 
11 #ifndef MAKEDEPEND
12 # include <string>
13 #endif
14 
15 namespace XmlRpc {
16 
17   // Representation of a parameter or result value
18   class XmlRpcValue;
19 
20   // The XmlRpcServer processes client requests to call RPCs
21   class XmlRpcServer;
22 
23   //! Abstract class representing a single RPC method
24   class XmlRpcServerMethod {
25   public:
26     //! Constructor
27     XmlRpcServerMethod(std::string const& name, XmlRpcServer* server = 0);
28     //! Destructor
29     virtual ~XmlRpcServerMethod();
30 
31     //! Returns the name of the method
name()32     std::string& name() { return _name; }
33 
34     //! Execute the method. Subclasses must provide a definition for this method.
35     virtual void execute(XmlRpcValue& params, XmlRpcValue& result) = 0;
36 
37     //! Returns a help string for the method.
38     //! Subclasses should define this method if introspection is being used.
help()39     virtual std::string help() { return std::string(); }
40 
41   protected:
42     std::string _name;
43     XmlRpcServer* _server;
44   };
45 } // namespace XmlRpc
46 
47 #endif // _XMLRPCSERVERMETHOD_H_
48