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

Method Value

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

! internal Default constructor initialization must be equivalent to: * memset( this, 0, sizeof(Value) ) * This optimization is used in ValueInternalMap fast allocator. */

Source from the content-addressed store, hash-verified

345 * This optimization is used in ValueInternalMap fast allocator.
346 */
347Value::Value(ValueType type) {
348 static char const emptyString[] = "";
349 initBasic(type);
350 switch (type) {
351 case nullValue:
352 break;
353 case intValue:
354 case uintValue:
355 value_.int_ = 0;
356 break;
357 case realValue:
358 value_.real_ = 0.0;
359 break;
360 case stringValue:
361 // allocated_ == false, so this is safe.
362 value_.string_ = const_cast<char*>(static_cast<char const*>(emptyString));
363 break;
364 case arrayValue:
365 case objectValue:
366 value_.map_ = new ObjectValues();
367 break;
368 case booleanValue:
369 value_.bool_ = false;
370 break;
371 default:
372 JSON_ASSERT_UNREACHABLE;
373 }
374}
375
376Value::Value(Int value) {
377 initBasic(intValue);

Callers 2

DoGenerateMethod · 0.80

Calls 6

lengthMethod · 0.80
c_strMethod · 0.80
strlenFunction · 0.50
swapFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected