| 695 | } |
| 696 | |
| 697 | JSONCPP_STRING Value::asString() const { |
| 698 | switch (type_) { |
| 699 | case nullValue: |
| 700 | return ""; |
| 701 | case stringValue: |
| 702 | { |
| 703 | if (value_.string_ == 0) return ""; |
| 704 | unsigned this_len; |
| 705 | char const* this_str; |
| 706 | decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); |
| 707 | return JSONCPP_STRING(this_str, this_len); |
| 708 | } |
| 709 | case booleanValue: |
| 710 | return value_.bool_ ? "true" : "false"; |
| 711 | case intValue: |
| 712 | return valueToString(value_.int_); |
| 713 | case uintValue: |
| 714 | return valueToString(value_.uint_); |
| 715 | case realValue: |
| 716 | return valueToString(value_.real_); |
| 717 | default: |
| 718 | JSON_FAIL_MESSAGE("Type is not convertible to string"); |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | #ifdef JSON_USE_CPPTL |
| 723 | CppTL::ConstString Value::asConstString() const { |
no test coverage detected