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