NOLINTNEXTLINE(misc-no-recursion)
| 1218 | |
| 1219 | // NOLINTNEXTLINE(misc-no-recursion) |
| 1220 | std::string RPCArg::ToStringObj(const bool oneline) const |
| 1221 | { |
| 1222 | std::string res; |
| 1223 | res += "\""; |
| 1224 | res += GetFirstName(); |
| 1225 | if (oneline) { |
| 1226 | res += "\":"; |
| 1227 | } else { |
| 1228 | res += "\": "; |
| 1229 | } |
| 1230 | switch (m_type) { |
| 1231 | case Type::STR: |
| 1232 | return res + "\"str\""; |
| 1233 | case Type::STR_HEX: |
| 1234 | return res + "\"hex\""; |
| 1235 | case Type::NUM: |
| 1236 | return res + "n"; |
| 1237 | case Type::RANGE: |
| 1238 | return res + "n or [n,n]"; |
| 1239 | case Type::AMOUNT: |
| 1240 | return res + "amount"; |
| 1241 | case Type::BOOL: |
| 1242 | return res + "bool"; |
| 1243 | case Type::ARR: |
| 1244 | res += "["; |
| 1245 | for (const auto& i : m_inner) { |
| 1246 | res += i.ToString(oneline) + ","; |
| 1247 | } |
| 1248 | return res + "...]"; |
| 1249 | case Type::OBJ: |
| 1250 | case Type::OBJ_NAMED_PARAMS: |
| 1251 | case Type::OBJ_USER_KEYS: |
| 1252 | // Currently unused, so avoid writing dead code |
| 1253 | NONFATAL_UNREACHABLE(); |
| 1254 | } // no default case, so the compiler can warn about missing cases |
| 1255 | NONFATAL_UNREACHABLE(); |
| 1256 | } |
| 1257 | |
| 1258 | // NOLINTNEXTLINE(misc-no-recursion) |
| 1259 | std::string RPCArg::ToString(const bool oneline) const |