MCPcopy Create free account
hub / github.com/Samsung/UTopia / dupPayload

Method dupPayload

external/jsoncpp/jsoncpp.cpp:3381–3411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3379}
3380
3381void Value::dupPayload(const Value &other) {
3382 setType(other.type());
3383 setIsAllocated(false);
3384 switch (type()) {
3385 case nullValue:
3386 case intValue:
3387 case uintValue:
3388 case realValue:
3389 case booleanValue:
3390 value_ = other.value_;
3391 break;
3392 case stringValue:
3393 if (other.value_.string_ && other.isAllocated()) {
3394 unsigned len;
3395 char const *str;
3396 decodePrefixedString(other.isAllocated(), other.value_.string_, &len,
3397 &str);
3398 value_.string_ = duplicateAndPrefixStringValue(str, len);
3399 setIsAllocated(true);
3400 } else {
3401 value_.string_ = other.value_.string_;
3402 }
3403 break;
3404 case arrayValue:
3405 case objectValue:
3406 value_.map_ = new ObjectValues(*other.value_.map_);
3407 break;
3408 default:
3409 JSON_ASSERT_UNREACHABLE;
3410 }
3411}
3412
3413void Value::releasePayload() {
3414 switch (type()) {

Callers

nothing calls this directly

Calls 4

setIsAllocatedFunction · 0.85
decodePrefixedStringFunction · 0.85
typeMethod · 0.80

Tested by

no test coverage detected