| 3121 | } |
| 3122 | |
| 3123 | JSONCPP_STRING Value::asString() const { |
| 3124 | switch (type_) { |
| 3125 | case nullValue: |
| 3126 | return ""; |
| 3127 | case stringValue: { |
| 3128 | if (value_.string_ == 0) |
| 3129 | return ""; |
| 3130 | unsigned this_len; |
| 3131 | char const* this_str; |
| 3132 | decodePrefixedString(this->allocated_, this->value_.string_, &this_len, |
| 3133 | &this_str); |
| 3134 | return JSONCPP_STRING(this_str, this_len); |
| 3135 | } |
| 3136 | case booleanValue: |
| 3137 | return value_.bool_ ? "true" : "false"; |
| 3138 | case intValue: |
| 3139 | return valueToString(value_.int_); |
| 3140 | case uintValue: |
| 3141 | return valueToString(value_.uint_); |
| 3142 | case realValue: |
| 3143 | return valueToString(value_.real_); |
| 3144 | default: |
| 3145 | JSON_FAIL_MESSAGE("Type is not convertible to string"); |
| 3146 | } |
| 3147 | } |
| 3148 | |
| 3149 | #ifdef JSON_USE_CPPTL |
| 3150 | CppTL::ConstString Value::asConstString() const { |
no test coverage detected