util: Move util/string.h functions to util namespace

There are no changes to behavior. Changes in this commit are all additions, and
are easiest to review using "git diff -U0 --word-diff-regex=." options.

Motivation for this change is to keep util functions with really generic names
like "Split" and "Join" out of the global namespace so it is easier to see
where these functions are defined, and so they don't interfere with function
overloading, especially since the util library is a dependency of the kernel
library and intended to be used with external code.
This commit is contained in:
Ryan Ofsky
2023-12-06 15:13:39 -05:00
parent 4d05d3f3b4
commit 4f74c59334
70 changed files with 159 additions and 14 deletions

View File

@@ -37,6 +37,9 @@ using common::PSBTError;
using common::PSBTErrorString;
using common::TransactionErrorString;
using node::TransactionError;
using util::Join;
using util::SplitString;
using util::TrimString;
const std::string UNIX_EPOCH_TIME = "UNIX epoch time";
const std::string EXAMPLE_ADDRESS[2] = {"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl", "bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"};
@@ -796,7 +799,7 @@ std::string RPCHelpMan::ToString() const
if (arg.m_opts.hidden) break; // Any arg that follows is also hidden
// Push named argument name and description
sections.m_sections.emplace_back(::ToString(i + 1) + ". " + arg.GetFirstName(), arg.ToDescriptionString(/*is_named_arg=*/true));
sections.m_sections.emplace_back(util::ToString(i + 1) + ". " + arg.GetFirstName(), arg.ToDescriptionString(/*is_named_arg=*/true));
sections.m_max_pad = std::max(sections.m_max_pad, sections.m_sections.back().m_left.size());
// Recursively push nested args