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

Method dupPayload

Utilities/cmjsoncpp/src/lib_json/json_value.cpp:976–1006  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974}
975
976void Value::dupPayload(const Value& other) {
977 setType(other.type());
978 setIsAllocated(false);
979 switch (type()) {
980 case nullValue:
981 case intValue:
982 case uintValue:
983 case realValue:
984 case booleanValue:
985 value_ = other.value_;
986 break;
987 case stringValue:
988 if (other.value_.string_ && other.isAllocated()) {
989 unsigned len;
990 char const* str;
991 decodePrefixedString(other.isAllocated(), other.value_.string_, &len,
992 &str);
993 value_.string_ = duplicateAndPrefixStringValue(str, len);
994 setIsAllocated(true);
995 } else {
996 value_.string_ = other.value_.string_;
997 }
998 break;
999 case arrayValue:
1000 case objectValue:
1001 value_.map_ = new ObjectValues(*other.value_.map_);
1002 break;
1003 default:
1004 JSON_ASSERT_UNREACHABLE;
1005 }
1006}
1007
1008void Value::releasePayload() {
1009 switch (type()) {

Callers

nothing calls this directly

Calls 5

setIsAllocatedFunction · 0.85
decodePrefixedStringFunction · 0.85
typeClass · 0.50
typeMethod · 0.45

Tested by

no test coverage detected