Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/util.h
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | struct RPCArg { | ||||
using Fallback = | using Fallback = | ||||
boost::variant<Optional, | boost::variant<Optional, | ||||
/* default value for optional args */ std::string>; | /* default value for optional args */ std::string>; | ||||
//! The name of the arg (can be empty for inner args, can contain multiple | //! The name of the arg (can be empty for inner args, can contain multiple | ||||
//! aliases separated by | for named request arguments) | //! aliases separated by | for named request arguments) | ||||
const std::string m_names; | const std::string m_names; | ||||
const Type m_type; | const Type m_type; | ||||
const bool m_hidden; | |||||
//! Only used for arrays or dicts | //! Only used for arrays or dicts | ||||
const std::vector<RPCArg> m_inner; | const std::vector<RPCArg> m_inner; | ||||
const Fallback m_fallback; | const Fallback m_fallback; | ||||
const std::string m_description; | const std::string m_description; | ||||
//! Should be empty unless it is supposed to override the auto-generated | //! Should be empty unless it is supposed to override the auto-generated | ||||
//! summary line | //! summary line | ||||
const std::string m_oneline_description; | const std::string m_oneline_description; | ||||
//! Should be empty unless it is supposed to override the | //! Should be empty unless it is supposed to override the | ||||
//! auto-generated type strings. Vector length is either 0 | //! auto-generated type strings. Vector length is either 0 | ||||
//! or 2, m_type_str.at(0) will override the type of the | //! or 2, m_type_str.at(0) will override the type of the | ||||
//! value in a key-value pair, m_type_str.at(1) will | //! value in a key-value pair, m_type_str.at(1) will | ||||
//! override the type in the argument description. | //! override the type in the argument description. | ||||
const std::vector<std::string> m_type_str; | const std::vector<std::string> m_type_str; | ||||
RPCArg(const std::string name, const Type type, const Fallback fallback, | RPCArg(const std::string name, const Type type, const Fallback fallback, | ||||
const std::string description, | const std::string description, | ||||
const std::string oneline_description = "", | const std::string oneline_description = "", | ||||
const std::vector<std::string> type_str = {}) | const std::vector<std::string> type_str = {}, | ||||
: m_names{std::move(name)}, m_type{std::move(type)}, | const bool hidden = false) | ||||
: m_names{std::move(name)}, m_type{std::move(type)}, m_hidden{hidden}, | |||||
m_fallback{std::move(fallback)}, m_description{std::move( | m_fallback{std::move(fallback)}, m_description{std::move( | ||||
description)}, | description)}, | ||||
m_oneline_description{std::move(oneline_description)}, | m_oneline_description{std::move(oneline_description)}, | ||||
m_type_str{std::move(type_str)} { | m_type_str{std::move(type_str)} { | ||||
CHECK_NONFATAL(type != Type::ARR && type != Type::OBJ); | CHECK_NONFATAL(type != Type::ARR && type != Type::OBJ); | ||||
} | } | ||||
RPCArg(const std::string name, const Type type, const Fallback fallback, | RPCArg(const std::string name, const Type type, const Fallback fallback, | ||||
const std::string description, const std::vector<RPCArg> inner, | const std::string description, const std::vector<RPCArg> inner, | ||||
const std::string oneline_description = "", | const std::string oneline_description = "", | ||||
const std::vector<std::string> type_str = {}) | const std::vector<std::string> type_str = {}) | ||||
: m_names{std::move(name)}, m_type{std::move(type)}, m_inner{std::move( | : m_names{std::move(name)}, m_type{std::move(type)}, m_hidden{false}, | ||||
inner)}, | m_inner{std::move(inner)}, m_fallback{std::move(fallback)}, | ||||
m_fallback{std::move(fallback)}, m_description{std::move( | m_description{std::move(description)}, | ||||
description)}, | |||||
m_oneline_description{std::move(oneline_description)}, | m_oneline_description{std::move(oneline_description)}, | ||||
m_type_str{std::move(type_str)} { | m_type_str{std::move(type_str)} { | ||||
CHECK_NONFATAL(type == Type::ARR || type == Type::OBJ); | CHECK_NONFATAL(type == Type::ARR || type == Type::OBJ); | ||||
} | } | ||||
bool IsOptional() const; | bool IsOptional() const; | ||||
/** Return the first of all aliases */ | /** Return the first of all aliases */ | ||||
▲ Show 20 Lines • Show All 150 Lines • Show Last 20 Lines |