! \internal Default constructor initialization must be equivalent to: * memset( this, 0, sizeof(Value) ) * This optimization is used in ValueInternalMap fast allocator. */
| 2459 | * This optimization is used in ValueInternalMap fast allocator. |
| 2460 | */ |
| 2461 | Value::Value(ValueType vtype) { |
| 2462 | initBasic(vtype); |
| 2463 | switch (vtype) { |
| 2464 | case nullValue: |
| 2465 | break; |
| 2466 | case intValue: |
| 2467 | case uintValue: |
| 2468 | value_.int_ = 0; |
| 2469 | break; |
| 2470 | case realValue: |
| 2471 | value_.real_ = 0.0; |
| 2472 | break; |
| 2473 | case stringValue: |
| 2474 | value_.string_ = 0; |
| 2475 | break; |
| 2476 | case arrayValue: |
| 2477 | case objectValue: |
| 2478 | value_.map_ = new ObjectValues(); |
| 2479 | break; |
| 2480 | case booleanValue: |
| 2481 | value_.bool_ = false; |
| 2482 | break; |
| 2483 | default: |
| 2484 | JSON_ASSERT_UNREACHABLE; |
| 2485 | } |
| 2486 | } |
| 2487 | |
| 2488 | Value::Value(Int value) { |
| 2489 | initBasic(intValue); |
no test coverage detected