! \internal Default constructor initialization must be equivalent to: * memset( this, 0, sizeof(Value) ) * This optimization is used in ValueInternalMap fast allocator. */
| 1715 | * This optimization is used in ValueInternalMap fast allocator. |
| 1716 | */ |
| 1717 | Value::Value(ValueType type) { |
| 1718 | initBasic(type); |
| 1719 | switch (type) { |
| 1720 | case nullValue: |
| 1721 | break; |
| 1722 | case intValue: |
| 1723 | case uintValue: |
| 1724 | value_.int_ = 0; |
| 1725 | break; |
| 1726 | case realValue: |
| 1727 | value_.real_ = 0.0; |
| 1728 | break; |
| 1729 | case stringValue: |
| 1730 | value_.string_ = 0; |
| 1731 | break; |
| 1732 | #ifndef JSON_VALUE_USE_INTERNAL_MAP |
| 1733 | case arrayValue: |
| 1734 | case objectValue: |
| 1735 | value_.map_ = new ObjectValues(); |
| 1736 | break; |
| 1737 | #else |
| 1738 | case arrayValue: |
| 1739 | value_.array_ = arrayAllocator()->newArray(); |
| 1740 | break; |
| 1741 | case objectValue: |
| 1742 | value_.map_ = mapAllocator()->newMap(); |
| 1743 | break; |
| 1744 | #endif |
| 1745 | case booleanValue: |
| 1746 | value_.bool_ = false; |
| 1747 | break; |
| 1748 | default: |
| 1749 | JSON_ASSERT_UNREACHABLE; |
| 1750 | } |
| 1751 | } |
| 1752 | |
| 1753 | Value::Value(Int value) { |
| 1754 | initBasic(intValue); |
nothing calls this directly
no test coverage detected