Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/util.cpp
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | for (const auto &arg : m_args) { | ||||
} | } | ||||
ret += arg.ToString(); | ret += arg.ToString(); | ||||
} | } | ||||
if (is_optional) { | if (is_optional) { | ||||
ret += " )"; | ret += " )"; | ||||
} | } | ||||
ret += "\n"; | ret += "\n"; | ||||
ret += m_description; | |||||
return ret; | return ret; | ||||
} | } | ||||
std::string RPCArg::ToStringObj() const { | std::string RPCArg::ToStringObj() const { | ||||
std::string res = "\"" + m_name + "\":"; | std::string res = "\"" + m_name + "\":"; | ||||
switch (m_type) { | switch (m_type) { | ||||
case Type::STR: | case Type::STR: | ||||
return res + "\"str\""; | return res + "\"str\""; | ||||
Show All 17 Lines | switch (m_type) { | ||||
assert(false); | assert(false); | ||||
// no default case, so the compiler can warn about missing cases | // no default case, so the compiler can warn about missing cases | ||||
} | } | ||||
assert(false); | assert(false); | ||||
} | } | ||||
std::string RPCArg::ToString() const { | std::string RPCArg::ToString() const { | ||||
if (!m_oneline_description.empty()) { | |||||
return m_oneline_description; | |||||
} | |||||
switch (m_type) { | switch (m_type) { | ||||
case Type::STR_HEX: | case Type::STR_HEX: | ||||
case Type::STR: { | case Type::STR: { | ||||
return "\"" + m_name + "\""; | return "\"" + m_name + "\""; | ||||
} | } | ||||
case Type::NUM: | case Type::NUM: | ||||
case Type::AMOUNT: | case Type::AMOUNT: | ||||
case Type::BOOL: { | case Type::BOOL: { | ||||
Show All 29 Lines |