#include <util.h>
|
enum | Type {
Type::OBJ,
Type::ARR,
Type::STR,
Type::NUM,
Type::BOOL,
Type::OBJ_USER_KEYS,
Type::AMOUNT,
Type::STR_HEX,
Type::RANGE
} |
|
enum | Optional { Optional::NO,
Optional::OMITTED_NAMED_ARG,
Optional::OMITTED
} |
|
using | Fallback = std::variant< Optional, std::string > |
|
|
| RPCArg (const std::string name, const Type type, const Fallback fallback, const std::string description, const std::string oneline_description="", const std::vector< std::string > type_str={}, const bool hidden=false) |
|
| RPCArg (const std::string name, const Type type, const Fallback fallback, const std::string description, const std::vector< RPCArg > inner, const std::string oneline_description="", const std::vector< std::string > type_str={}) |
|
bool | IsOptional () const |
|
std::string | GetFirstName () const |
| Return the first of all aliases. More...
|
|
std::string | GetName () const |
| Return the name, throws when there are aliases. More...
|
|
std::string | ToString (bool oneline) const |
| Return the type string of the argument. More...
|
|
std::string | ToStringObj (bool oneline) const |
| Return the type string of the argument when it is in an object (dict). More...
|
|
std::string | ToDescriptionString () const |
| Return the description string, including the argument type and whether the argument is required. More...
|
|
|
const std::string | m_names |
| The name of the arg (can be empty for inner args, can contain multiple aliases separated by | for named request arguments) More...
|
|
const Type | m_type |
|
const bool | m_hidden |
|
const std::vector< RPCArg > | m_inner |
| Only used for arrays or dicts. More...
|
|
const Fallback | m_fallback |
|
const std::string | m_description |
|
const std::string | m_oneline_description |
| Should be empty unless it is supposed to override the auto-generated summary line. More...
|
|
const std::vector< std::string > | m_type_str |
| Should be empty unless it is supposed to override the auto-generated type strings. Vector length is either 0 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 override the type in the argument description. More...
|
|
Definition at line 117 of file util.h.
◆ Fallback
◆ Optional
Enumerator |
---|
NO | Required arg.
|
OMITTED_NAMED_ARG | Optional arg that is a named argument and has a default value of null .
When possible, the default value should be specified.
|
OMITTED | Optional argument with default value omitted because they are implicitly clear.
That is, elements in an array or object may not exist by default. When possible, the default value should be specified.
|
Definition at line 130 of file util.h.
◆ Type
Enumerator |
---|
OBJ | |
ARR | |
STR | |
NUM | |
BOOL | |
OBJ_USER_KEYS | Special type where the user must set the keys e.g. to define multiple addresses; as opposed to e.g. an options object where the keys are predefined.
|
AMOUNT | Special type representing a floating point amount (can be either NUM or STR)
|
STR_HEX | Special type that is a STR with only hex chars.
|
RANGE | Special type that is a NUM or [NUM,NUM].
|
Definition at line 118 of file util.h.
◆ RPCArg() [1/2]
RPCArg::RPCArg |
( |
const std::string |
name, |
|
|
const Type |
type, |
|
|
const Fallback |
fallback, |
|
|
const std::string |
description, |
|
|
const std::string |
oneline_description = "" , |
|
|
const std::vector< std::string > |
type_str = {} , |
|
|
const bool |
hidden = false |
|
) |
| |
|
inline |
◆ RPCArg() [2/2]
RPCArg::RPCArg |
( |
const std::string |
name, |
|
|
const Type |
type, |
|
|
const Fallback |
fallback, |
|
|
const std::string |
description, |
|
|
const std::vector< RPCArg > |
inner, |
|
|
const std::string |
oneline_description = "" , |
|
|
const std::vector< std::string > |
type_str = {} |
|
) |
| |
|
inline |
◆ GetFirstName()
std::string RPCArg::GetFirstName |
( |
| ) |
const |
Return the first of all aliases.
Definition at line 552 of file util.cpp.
◆ GetName()
std::string RPCArg::GetName |
( |
| ) |
const |
Return the name, throws when there are aliases.
Definition at line 557 of file util.cpp.
◆ IsOptional()
bool RPCArg::IsOptional |
( |
| ) |
const |
◆ ToDescriptionString()
std::string RPCArg::ToDescriptionString |
( |
| ) |
const |
Return the description string, including the argument type and whether the argument is required.
Definition at line 572 of file util.cpp.
◆ ToString()
std::string RPCArg::ToString |
( |
bool |
oneline | ) |
const |
Return the type string of the argument.
Set oneline to allow it to be overridden by a custom oneline type string (m_oneline_description).
Definition at line 764 of file util.cpp.
◆ ToStringObj()
std::string RPCArg::ToStringObj |
( |
bool |
oneline | ) |
const |
Return the type string of the argument when it is in an object (dict).
Set oneline to get the oneline representation (less whitespace)
Definition at line 727 of file util.cpp.
◆ m_description
const std::string RPCArg::m_description |
◆ m_fallback
◆ m_hidden
const bool RPCArg::m_hidden |
◆ m_inner
const std::vector<RPCArg> RPCArg::m_inner |
Only used for arrays or dicts.
Definition at line 150 of file util.h.
◆ m_names
const std::string RPCArg::m_names |
The name of the arg (can be empty for inner args, can contain multiple aliases separated by | for named request arguments)
Definition at line 147 of file util.h.
◆ m_oneline_description
const std::string RPCArg::m_oneline_description |
Should be empty unless it is supposed to override the auto-generated summary line.
Definition at line 153 of file util.h.
◆ m_type
const Type RPCArg::m_type |
◆ m_type_str
const std::vector<std::string> RPCArg::m_type_str |
Should be empty unless it is supposed to override the auto-generated type strings. Vector length is either 0 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 override the type in the argument description.
Definition at line 154 of file util.h.
The documentation for this struct was generated from the following files: