NOLINTNEXTLINE(misc-no-recursion)
| 933 | |
| 934 | // NOLINTNEXTLINE(misc-no-recursion) |
| 935 | virtual bool ToStringHelper(const SigningProvider* arg, std::string& out, const StringType type, const DescriptorCache* cache = nullptr) const |
| 936 | { |
| 937 | std::string extra = ToStringExtra(); |
| 938 | size_t pos = extra.size() > 0 ? 1 : 0; |
| 939 | std::string ret = m_name + "(" + extra; |
| 940 | bool is_private{type == StringType::PRIVATE}; |
| 941 | // For private string output, track if at least one key has a private key available. |
| 942 | // Initialize to true for non-private types. |
| 943 | bool any_success{!is_private}; |
| 944 | |
| 945 | for (const auto& pubkey : m_pubkey_args) { |
| 946 | if (pos++) ret += ","; |
| 947 | std::string tmp; |
| 948 | switch (type) { |
| 949 | case StringType::NORMALIZED: |
| 950 | if (!pubkey->ToNormalizedString(*arg, tmp, cache)) return false; |
| 951 | break; |
| 952 | case StringType::PRIVATE: |
| 953 | any_success = pubkey->ToPrivateString(*arg, tmp) || any_success; |
| 954 | break; |
| 955 | case StringType::PUBLIC: |
| 956 | tmp = pubkey->ToString(); |
| 957 | break; |
| 958 | case StringType::COMPAT: |
| 959 | tmp = pubkey->ToString(PubkeyProvider::StringType::COMPAT); |
| 960 | break; |
| 961 | } |
| 962 | ret += tmp; |
| 963 | } |
| 964 | std::string subscript; |
| 965 | bool subscript_res{ToStringSubScriptHelper(arg, subscript, type, cache)}; |
| 966 | if (!is_private && !subscript_res) return false; |
| 967 | any_success = any_success || subscript_res; |
| 968 | if (pos && subscript.size()) ret += ','; |
| 969 | out = std::move(ret) + std::move(subscript) + ")"; |
| 970 | return any_success; |
| 971 | } |
| 972 | |
| 973 | std::string ToString(bool compat_format) const final |
| 974 | { |
no test coverage detected