MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / asString

Method asString

Sources/Dependencies/jsoncpp/value.cpp:649–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647#endif
648
649 StringContainer Value::asString() const {
650 switch (type()) {
651 case nullValue:
652 return "";
653 case stringValue: {
654 if (value_.string_ == nullptr)
655 return "";
656 unsigned this_len;
657 char const* this_str;
658 decodePrefixedString(this->isAllocated(), this->value_.string_, &this_len, &this_str);
659 return StringContainer(this_str, this_len);
660 }
661 case booleanValue:
662 return value_.bool_ ? "true" : "false";
663 case intValue:
664 return valueToString(value_.int_);
665 case uintValue:
666 return valueToString(value_.uint_);
667 case realValue:
668 return valueToString(value_.real_);
669 default:
670 JSON_FAIL_MESSAGE("Type is not convertible to string");
671 }
672 }
673
674 Value::Int Value::asInt() const {
675 switch (type()) {

Callers 2

newStreamWriterMethod · 0.80
readObjectMethod · 0.80

Calls 3

typeClass · 0.85
decodePrefixedStringFunction · 0.85
valueToStringFunction · 0.85

Tested by

no test coverage detected