Debian Codegraph @

src/xmlrpcpp/XmlRpcServerMethod.h

raw
1 // ----------------------------------------------------------------------------
2 //
3 // flxmlrpc Copyright (c) 2015 by W1HKJ, Dave Freese <[email protected]>
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 _XMLRPCSERVERMETHOD_H_
19 #define _XMLRPCSERVERMETHOD_H_
20
21 #if defined(_MSC_VER)
22 # pragma warning(disable:4786) // identifier was truncated in debug info
23 #endif
24
25 #include <string>
26
27 namespace XmlRpc {
28
29 // Representation of a parameter or result value
30 class XmlRpcValue;
31
32 // The XmlRpcServer processes client requests to call RPCs
33 class XmlRpcServer;
34
35 //! Abstract class representing a single RPC method
36 class XmlRpcServerMethod {
37 public:
38 //! Constructor
39 XmlRpcServerMethod(std::string const& name, XmlRpcServer* server = 0);
40 //! Destructor
41 virtual ~XmlRpcServerMethod();
42
43 //! Returns the name of the method
44 std::string& name() { return _name; }
45
46 //! Execute the method. Subclasses must provide a definition for this method.
47 virtual void execute(XmlRpcValue& params, XmlRpcValue& result) = 0;
48
49 //! Returns a help string for the method.
50 //! Subclasses should define this method if introspection is being used.
51 virtual std::string help() { return std::string(); }
52
53 protected:
54 std::string _name;
55 XmlRpcServer* _server;
56 };
57 } // namespace XmlRpc
58
59 #endif // _XMLRPCSERVERMETHOD_H_