MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / asString

Method asString

Source/JSON/jsoncpp.cpp:2760–2782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2758}
2759
2760std::string Value::asString() const {
2761 switch (type_) {
2762 case nullValue:
2763 return "";
2764 case stringValue: {
2765 if (value_.string_ == 0) return "";
2766 unsigned this_len;
2767 char const* this_str;
2768 decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
2769 return std::string(this_str, this_len);
2770 }
2771 case booleanValue:
2772 return value_.bool_ ? "true" : "false";
2773 case intValue:
2774 return valueToString(value_.int_);
2775 case uintValue:
2776 return valueToString(value_.uint_);
2777 case realValue:
2778 return valueToString(value_.real_);
2779 default:
2780 JSON_FAIL_MESSAGE("Type is not convertible to string");
2781 }
2782}
2783
2784#ifdef JSON_USE_CPPTL
2785CppTL::ConstString Value::asConstString() const {

Callers 7

ParseBodyDefMethod · 0.45
ParseDrawShapeDefMethod · 0.45
ParseJointMethod · 0.45
SearchJSONMethod · 0.45
readObjectMethod · 0.45
newStreamWriterMethod · 0.45

Calls 2

decodePrefixedStringFunction · 0.70
valueToStringFunction · 0.70

Tested by

no test coverage detected