MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / Value

Method Value

src/share/jsoncpp/jsoncpp.cpp:2793–2820  ·  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

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

Callers

nothing calls this directly

Calls 6

decodePrefixedStringFunction · 0.85
swapFunction · 0.85
lengthMethod · 0.80
setCommentMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected