! \internal Default constructor initialization must be equivalent to: * memset( this, 0, sizeof(Value) ) * This optimization is used in ValueInternalMap fast allocator. */
| 297 | * This optimization is used in ValueInternalMap fast allocator. |
| 298 | */ |
| 299 | Value::Value(ValueType vtype) { |
| 300 | initBasic(vtype); |
| 301 | switch (vtype) { |
| 302 | case nullValue: |
| 303 | break; |
| 304 | case intValue: |
| 305 | case uintValue: |
| 306 | value_.int_ = 0; |
| 307 | break; |
| 308 | case realValue: |
| 309 | value_.real_ = 0.0; |
| 310 | break; |
| 311 | case stringValue: |
| 312 | value_.string_ = 0; |
| 313 | break; |
| 314 | case arrayValue: |
| 315 | case objectValue: |
| 316 | value_.map_ = new ObjectValues(); |
| 317 | break; |
| 318 | case booleanValue: |
| 319 | value_.bool_ = false; |
| 320 | break; |
| 321 | default: |
| 322 | JSON_ASSERT_UNREACHABLE; |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | Value::Value(Int value) { |
| 327 | initBasic(intValue); |
no test coverage detected