MCPcopy Create free account
hub / github.com/ElementsProject/elements / ToStringObj

Method ToStringObj

src/rpc/util.cpp:926–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

924}
925
926std::string RPCArg::ToStringObj(const bool oneline) const
927{
928 std::string res;
929 res += "\"";
930 res += GetFirstName();
931 if (oneline) {
932 res += "\":";
933 } else {
934 res += "\": ";
935 }
936 switch (m_type) {
937 case Type::STR:
938 return res + "\"str\"";
939 case Type::STR_HEX:
940 return res + "\"hex\"";
941 case Type::NUM:
942 return res + "n";
943 case Type::RANGE:
944 return res + "n or [n,n]";
945 case Type::AMOUNT:
946 return res + "amount";
947 case Type::BOOL:
948 return res + "bool";
949 case Type::ARR:
950 res += "[";
951 for (const auto& i : m_inner) {
952 res += i.ToString(oneline) + ",";
953 }
954 return res + "...]";
955 case Type::OBJ:
956 case Type::OBJ_USER_KEYS:
957 // Currently unused, so avoid writing dead code
958 CHECK_NONFATAL(false);
959 } // no default case, so the compiler can warn about missing cases
960 CHECK_NONFATAL(false);
961}
962
963std::string RPCArg::ToString(const bool oneline) const
964{

Callers 2

PushMethod · 0.80
ToStringMethod · 0.80

Calls 1

ToStringMethod · 0.45

Tested by

no test coverage detected