| 930 | } |
| 931 | |
| 932 | bool TJsonValue::operator==(const TJsonValue& rhs) const { |
| 933 | switch (Type) { |
| 934 | case JSON_UNDEFINED: |
| 935 | return (rhs.GetType() == JSON_UNDEFINED); |
| 936 | case JSON_NULL: |
| 937 | return rhs.IsNull(); |
| 938 | case JSON_BOOLEAN: |
| 939 | return (rhs.IsBoolean() && Value.Boolean == rhs.Value.Boolean); |
| 940 | case JSON_INTEGER: |
| 941 | return (rhs.IsInteger() && GetInteger() == rhs.GetInteger()); |
| 942 | case JSON_UINTEGER: |
| 943 | return (rhs.IsUInteger() && GetUInteger() == rhs.GetUInteger()); |
| 944 | case JSON_STRING: |
| 945 | return (rhs.IsString() && Value.String == rhs.Value.String); |
| 946 | case JSON_DOUBLE: |
| 947 | return (rhs.IsDouble() && fabs(GetDouble() - rhs.GetDouble()) <= FLT_EPSILON); |
| 948 | case JSON_MAP: |
| 949 | return AreJsonMapsEqual(*this, rhs); |
| 950 | case JSON_ARRAY: |
| 951 | return AreJsonArraysEqual(*this, rhs); |
| 952 | default: |
| 953 | Y_ASSERT(false && "Unknown type."); |
| 954 | return false; |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | void TJsonValue::SwapWithUndefined(TJsonValue& output) noexcept { |
| 959 | if (Type == JSON_STRING) { |
nothing calls this directly
no test coverage detected