| 1006 | } |
| 1007 | |
| 1008 | bool TJsonValue::operator==(const TJsonValue& rhs) const { |
| 1009 | switch (Type) { |
| 1010 | case JSON_UNDEFINED: |
| 1011 | return (rhs.GetType() == JSON_UNDEFINED); |
| 1012 | case JSON_NULL: |
| 1013 | return rhs.IsNull(); |
| 1014 | case JSON_BOOLEAN: |
| 1015 | return (rhs.IsBoolean() && Value.Boolean == rhs.Value.Boolean); |
| 1016 | case JSON_INTEGER: |
| 1017 | return (rhs.IsInteger() && GetInteger() == rhs.GetInteger()); |
| 1018 | case JSON_UINTEGER: |
| 1019 | return (rhs.IsUInteger() && GetUInteger() == rhs.GetUInteger()); |
| 1020 | case JSON_STRING: |
| 1021 | return (rhs.IsString() && Value.String == rhs.Value.String); |
| 1022 | case JSON_DOUBLE: |
| 1023 | return (rhs.IsDouble() && fabs(GetDouble() - rhs.GetDouble()) <= FLT_EPSILON); |
| 1024 | case JSON_MAP: |
| 1025 | return AreJsonMapsEqual(*this, rhs); |
| 1026 | case JSON_ARRAY: |
| 1027 | return AreJsonArraysEqual(*this, rhs); |
| 1028 | default: |
| 1029 | Y_ASSERT(false && "Unknown type."); |
| 1030 | return false; |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | void TJsonValue::SwapWithUndefined(TJsonValue& output) noexcept { |
| 1035 | if (Type == JSON_STRING) { |
nothing calls this directly
no test coverage detected