diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-12-04 13:30:06 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-12-04 13:47:49 -0500 |
commit | fabca42c68ee4cdff08d30e91412ccf1de6d7b41 (patch) | |
tree | aeaab7e7d2bbba758858daa52f7b91580a8c6636 /src/rpc/util.cpp | |
parent | fafd040f7321294d5e4335b9581a6bd46a714c37 (diff) |
RPCHelpMan: Add space after colons in extended description
Also, add doxygen comment to ToDescriptionString
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r-- | src/rpc/util.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index a1c0134146..bb1c315bc7 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -165,9 +165,9 @@ struct Sections { if (outer_type == OuterType::NAMED_ARG) return; // Nothing more to do for non-recursive types on first recursion auto left = indent; if (arg.m_type_str.size() != 0 && outer_type == OuterType::OBJ) { - left += "\"" + arg.m_name + "\":" + arg.m_type_str.at(0); + left += "\"" + arg.m_name + "\": " + arg.m_type_str.at(0); } else { - left += outer_type == OuterType::OBJ ? arg.ToStringObj() : arg.ToString(); + left += outer_type == OuterType::OBJ ? arg.ToStringObj(/* oneline */ false) : arg.ToString(/* oneline */ false); } left += ","; PushSection({left, arg.ToDescriptionString(/* implicitly_required */ outer_type == OuterType::ARR)}); @@ -188,7 +188,7 @@ struct Sections { } case RPCArg::Type::ARR: { auto left = indent; - left += outer_type == OuterType::OBJ ? "\"" + arg.m_name + "\":" : ""; + left += outer_type == OuterType::OBJ ? "\"" + arg.m_name + "\": " : ""; left += "["; const auto right = outer_type == OuterType::NAMED_ARG ? "" : arg.ToDescriptionString(/* implicitly_required */ outer_type == OuterType::ARR); PushSection({left, right}); @@ -345,9 +345,16 @@ std::string RPCArg::ToDescriptionString(const bool implicitly_required) const return ret; } -std::string RPCArg::ToStringObj() const +std::string RPCArg::ToStringObj(const bool oneline) const { - std::string res = "\"" + m_name + "\":"; + std::string res; + res += "\""; + res += m_name; + if (oneline) { + res += "\":"; + } else { + res += "\": "; + } switch (m_type) { case Type::STR: return res + "\"str\""; @@ -362,7 +369,7 @@ std::string RPCArg::ToStringObj() const case Type::ARR: res += "["; for (const auto& i : m_inner) { - res += i.ToString() + ","; + res += i.ToString(oneline) + ","; } return res + "...]"; case Type::OBJ: @@ -393,7 +400,7 @@ std::string RPCArg::ToString(const bool oneline) const case Type::OBJ_USER_KEYS: { std::string res; for (size_t i = 0; i < m_inner.size();) { - res += m_inner[i].ToStringObj(); + res += m_inner[i].ToStringObj(oneline); if (++i < m_inner.size()) res += ","; } if (m_type == Type::OBJ) { |