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

Method Value

external/jsoncpp/jsoncpp.cpp:2735–2762  ·  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

2733 * This optimization is used in ValueInternalMap fast allocator.
2734 */
2735Value::Value(ValueType type) {
2736 static char const emptyString[] = "";
2737 initBasic(type);
2738 switch (type) {
2739 case nullValue:
2740 break;
2741 case intValue:
2742 case uintValue:
2743 value_.int_ = 0;
2744 break;
2745 case realValue:
2746 value_.real_ = 0.0;
2747 break;
2748 case stringValue:
2749 // allocated_ == false, so this is safe.
2750 value_.string_ = const_cast<char *>(static_cast<char const *>(emptyString));
2751 break;
2752 case arrayValue:
2753 case objectValue:
2754 value_.map_ = new ObjectValues();
2755 break;
2756 case booleanValue:
2757 value_.bool_ = false;
2758 break;
2759 default:
2760 JSON_ASSERT_UNREACHABLE;
2761 }
2762}
2763
2764Value::Value(Int value) {
2765 initBasic(intValue);

Callers

nothing calls this directly

Calls 4

swapFunction · 0.85
dataMethod · 0.80
lengthMethod · 0.80

Tested by

no test coverage detected