MCPcopy Create free account
hub / github.com/Kitware/VTK / dupPayload

Method dupPayload

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:3414–3444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3412}
3413
3414void Value::dupPayload(const Value& other) {
3415 setType(other.type());
3416 setIsAllocated(false);
3417 switch (type()) {
3418 case nullValue:
3419 case intValue:
3420 case uintValue:
3421 case realValue:
3422 case booleanValue:
3423 value_ = other.value_;
3424 break;
3425 case stringValue:
3426 if (other.value_.string_ && other.isAllocated()) {
3427 unsigned len;
3428 char const* str;
3429 decodePrefixedString(other.isAllocated(), other.value_.string_, &len,
3430 &str);
3431 value_.string_ = duplicateAndPrefixStringValue(str, len);
3432 setIsAllocated(true);
3433 } else {
3434 value_.string_ = other.value_.string_;
3435 }
3436 break;
3437 case arrayValue:
3438 case objectValue:
3439 value_.map_ = new ObjectValues(*other.value_.map_);
3440 break;
3441 default:
3442 JSON_ASSERT_UNREACHABLE;
3443 }
3444}
3445
3446void Value::releasePayload() {
3447 switch (type()) {

Callers

nothing calls this directly

Calls 5

setIsAllocatedFunction · 0.85
decodePrefixedStringFunction · 0.85
typeEnum · 0.50
typeMethod · 0.45

Tested by

no test coverage detected