MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / asString

Method asString

src/jsoncpp.cpp:3062–3088  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3060}
3061
3062std::string Value::asString() const {
3063 switch (type_) {
3064 case nullValue:
3065 return "";
3066 case stringValue:
3067 {
3068 if (value_.string_ == 0) return "";
3069 unsigned this_len;
3070 char const* this_str;
3071 decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
3072 return std::string(this_str, this_len);
3073 }
3074 case booleanValue:
3075 return value_.bool_ ? "true" : "false";
3076 case intValue:
3077 return valueToString(value_.int_);
3078 case uintValue:
3079 return valueToString(value_.uint_);
3080 case realValue:
3081 return valueToString(value_.real_);
3082 default:
3083 if ( default_value_ )
3084 return default_value_->asString();
3085 else
3086 return "";
3087 }
3088}
3089
3090#ifdef JSON_USE_CPPTL
3091CppTL::ConstString Value::asConstString() const {

Callers 3

readObjectMethod · 0.80
newStreamWriterMethod · 0.80
ParseStringListFromJsonFunction · 0.80

Calls 2

decodePrefixedStringFunction · 0.85
valueToStringFunction · 0.85

Tested by

no test coverage detected