From fa483e13b387f244c1c72d4dbd709e669335618e Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 23 Oct 2018 15:22:28 -0400 Subject: rpc: Add RPCHelpMan for machine-generated help --- src/rpc/util.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src/rpc/util.h') diff --git a/src/rpc/util.h b/src/rpc/util.h index e21b5ba22a..55ae2fa363 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -30,4 +30,53 @@ CScript CreateMultisigRedeemscript(const int required, const std::vector m_inner; //!< Only used for arrays or dicts + const bool m_optional; + + RPCArg(const std::string& name, const Type& type, const bool optional) + : m_name{name}, m_type{type}, m_optional{optional} + { + assert(type != Type::ARR && type != Type::OBJ); + } + + RPCArg(const std::string& name, const Type& type, const std::vector& inner, const bool optional) + : m_name{name}, m_type{type}, m_inner{inner}, m_optional{optional} + { + assert(type == Type::ARR || type == Type::OBJ); + } + + std::string ToString() const; + +private: + std::string ToStringObj() const; +}; + +class RPCHelpMan +{ +public: + RPCHelpMan(const std::string& name, const std::vector& args) + : m_name{name}, m_args{args} + { + } + + std::string ToString() const; + +private: + const std::string m_name; + const std::vector m_args; +}; + #endif // BITCOIN_RPC_UTIL_H -- cgit v1.2.3