aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/util.cpp
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-09-30 10:03:27 +0200
committerMacroFake <falke.marco@gmail.com>2022-09-30 10:06:14 +0200
commit33eef562a321ce772a9a88073a78a85894cb3fe8 (patch)
tree98ff80d053e8afff56ec2323be3450ddb57b255e /src/rpc/util.cpp
parent437b608df289c97fd88f1dd79bdc8359e1b1c5b1 (diff)
parentfa2c72dda09f9b51332f6c7953ae81e573cc834f (diff)
Merge bitcoin/bitcoin#26074: refactor: Set RPCArg options with designated initializers
fa2c72dda09f9b51332f6c7953ae81e573cc834f rpc: Set RPCArg options with designated initializers (MacroFake) Pull request description: For optional constructor arguments, use a new struct. This comes with two benefits: * Earlier unused optional arguments can be omitted * Designated initializers can be used ACKs for top commit: stickies-v: re-ACK fa2c72dda09f9b51332f6c7953ae81e573cc834f Tree-SHA512: 2a0619548187cc7437fee2466ac4780746490622f202659f53641be01bc2a1fea4416d1a77f3e963bf7c4cce62899b61fab0b9683440cf82f68be44f63826658
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r--src/rpc/util.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 43935650fa..3e98e89791 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -418,8 +418,8 @@ struct Sections {
case RPCArg::Type::BOOL: {
if (outer_type == OuterType::NONE) return; // Nothing more to do for non-recursive types on first recursion
auto left = indent;
- if (arg.m_type_str.size() != 0 && push_name) {
- left += "\"" + arg.GetName() + "\": " + arg.m_type_str.at(0);
+ if (arg.m_opts.type_str.size() != 0 && push_name) {
+ left += "\"" + arg.GetName() + "\": " + arg.m_opts.type_str.at(0);
} else {
left += push_name ? arg.ToStringObj(/*oneline=*/false) : arg.ToString(/*oneline=*/false);
}
@@ -618,7 +618,7 @@ std::string RPCHelpMan::ToString() const
ret += m_name;
bool was_optional{false};
for (const auto& arg : m_args) {
- if (arg.m_hidden) break; // Any arg that follows is also hidden
+ if (arg.m_opts.hidden) break; // Any arg that follows is also hidden
const bool optional = arg.IsOptional();
ret += " ";
if (optional) {
@@ -639,7 +639,7 @@ std::string RPCHelpMan::ToString() const
Sections sections;
for (size_t i{0}; i < m_args.size(); ++i) {
const auto& arg = m_args.at(i);
- if (arg.m_hidden) break; // Any arg that follows is also hidden
+ if (arg.m_opts.hidden) break; // Any arg that follows is also hidden
if (i == 0) ret += "\nArguments:\n";
@@ -704,8 +704,8 @@ std::string RPCArg::ToDescriptionString() const
{
std::string ret;
ret += "(";
- if (m_type_str.size() != 0) {
- ret += m_type_str.at(1);
+ if (m_opts.type_str.size() != 0) {
+ ret += m_opts.type_str.at(1);
} else {
switch (m_type) {
case Type::STR_HEX:
@@ -991,7 +991,7 @@ std::string RPCArg::ToStringObj(const bool oneline) const
std::string RPCArg::ToString(const bool oneline) const
{
- if (oneline && !m_oneline_description.empty()) return m_oneline_description;
+ if (oneline && !m_opts.oneline_description.empty()) return m_opts.oneline_description;
switch (m_type) {
case Type::STR_HEX: