Bitcoin ABC
0.22.13
P2P Digital Currency
src
rpc
command.h
Go to the documentation of this file.
1
// Copyright (c) 2018-2019 The Bitcoin developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_RPC_COMMAND_H
6
#define BITCOIN_RPC_COMMAND_H
7
8
#include <
univalue.h
>
9
10
#include <boost/noncopyable.hpp>
11
12
#include <string>
13
14
class
JSONRPCRequest
;
15
22
class
RPCCommand
:
public
boost::noncopyable {
23
private
:
24
const
std::string
name
;
25
26
/*
27
* Child classes should define dependencies as private members.
28
* These dependencies must not be changed, or successive calls to the same
29
* command will give unexpected behavior.
30
*/
31
32
// TODO: Parameter definitions (these will be used to generate help
33
// messages as well)
34
35
public
:
36
RPCCommand
(
const
std::string &nameIn) : name(nameIn) {}
37
virtual
~RPCCommand
() {}
38
44
virtual
UniValue
Execute
(
const
JSONRPCRequest
&request)
const
= 0;
45
46
const
std::string &
GetName
()
const
{
return
name
; };
47
};
48
53
class
RPCCommandWithArgsContext
:
public
RPCCommand
{
54
public
:
55
RPCCommandWithArgsContext
(
const
std::string &nameIn) :
RPCCommand
(nameIn) {}
56
57
virtual
UniValue
Execute
(
const
UniValue
&args)
const
= 0;
58
59
UniValue
Execute
(
const
JSONRPCRequest
&request)
const
final
;
60
};
61
62
#endif // BITCOIN_RPC_COMMAND_H
RPCCommandWithArgsContext
By default, use RPCCommandWithArgsContext as the parent class for new RPC command classes that only d...
Definition:
command.h:53
RPCCommand::Execute
virtual UniValue Execute(const JSONRPCRequest &request) const =0
It is recommended to override Execute(JSONRPCRequest) only if the entire request context is required...
RPCCommand::~RPCCommand
virtual ~RPCCommand()
Definition:
command.h:37
UniValue
Definition:
univalue.h:23
RPCCommand::name
const std::string name
Definition:
command.h:24
RPCCommandWithArgsContext::RPCCommandWithArgsContext
RPCCommandWithArgsContext(const std::string &nameIn)
Definition:
command.h:55
univalue.h
RPCCommand
Base class for all RPC commands.
Definition:
command.h:22
JSONRPCRequest
Definition:
request.h:33
RPCCommand::RPCCommand
RPCCommand(const std::string &nameIn)
Definition:
command.h:36
RPCCommand::GetName
const std::string & GetName() const
Definition:
command.h:46
Generated on Wed Jan 27 2021 17:36:24 for Bitcoin ABC by
1.8.13