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

Method Value

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:2785–2812  ·  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

2783 * This optimization is used in ValueInternalMap fast allocator.
2784 */
2785Value::Value(ValueType type) {
2786 static char const emptyString[] = "";
2787 initBasic(type);
2788 switch (type) {
2789 case nullValue:
2790 break;
2791 case intValue:
2792 case uintValue:
2793 value_.int_ = 0;
2794 break;
2795 case realValue:
2796 value_.real_ = 0.0;
2797 break;
2798 case stringValue:
2799 // allocated_ == false, so this is safe.
2800 value_.string_ = const_cast<char*>(static_cast<char const*>(emptyString));
2801 break;
2802 case arrayValue:
2803 case objectValue:
2804 value_.map_ = new ObjectValues();
2805 break;
2806 case booleanValue:
2807 value_.bool_ = false;
2808 break;
2809 default:
2810 JSON_ASSERT_UNREACHABLE;
2811 }
2812}
2813
2814Value::Value(Int value) {
2815 initBasic(intValue);

Callers

nothing calls this directly

Calls 5

swapFunction · 0.50
dataMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected