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

Method MatchesType

src/rpc/util.cpp:879–913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

877}
878
879bool RPCResult::MatchesType(const UniValue& result) const
880{
881 switch (m_type) {
882 case Type::ELISION: {
883 return false;
884 }
885 case Type::ANY: {
886 return true;
887 }
888 case Type::NONE: {
889 return UniValue::VNULL == result.getType();
890 }
891 case Type::STR:
892 case Type::STR_HEX: {
893 return UniValue::VSTR == result.getType();
894 }
895 case Type::NUM:
896 case Type::STR_AMOUNT:
897 case Type::NUM_TIME: {
898 return UniValue::VNUM == result.getType();
899 }
900 case Type::BOOL: {
901 return UniValue::VBOOL == result.getType();
902 }
903 case Type::ARR_FIXED:
904 case Type::ARR: {
905 return UniValue::VARR == result.getType();
906 }
907 case Type::OBJ_DYN:
908 case Type::OBJ: {
909 return UniValue::VOBJ == result.getType();
910 }
911 } // no default case, so the compiler can warn about missing cases
912 CHECK_NONFATAL(false);
913}
914
915void RPCResult::CheckInnerDoc() const
916{

Callers 1

HandleRequestMethod · 0.80

Calls 1

getTypeMethod · 0.80

Tested by

no test coverage detected