diff options
author | trofimenkov <trofimenkov@yandex-team.ru> | 2022-02-10 16:49:31 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:31 +0300 |
commit | 7c6139b61ced2798d1134b68b8facf6925a36b8e (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/json/writer | |
parent | 30cebc2cfa79af3b577760a113e203a79450e6b6 (diff) | |
download | ydb-7c6139b61ced2798d1134b68b8facf6925a36b8e.tar.gz |
Restoring authorship annotation for <trofimenkov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json/writer')
-rw-r--r-- | library/cpp/json/writer/json_value.cpp | 28 | ||||
-rw-r--r-- | library/cpp/json/writer/json_value.h | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index 59dda03fe7..c61e8d1dc4 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -427,38 +427,38 @@ namespace NJson { bool TJsonValue::GetBooleanSafe() const { if (Type != JSON_BOOLEAN) ythrow TJsonException() << "Not a boolean"; - + return Value.Boolean; } - + long long TJsonValue::GetIntegerSafe() const { if (!IsInteger()) ythrow TJsonException() << "Not an integer"; - + return GetInteger(); } - + unsigned long long TJsonValue::GetUIntegerSafe() const { if (!IsUInteger()) ythrow TJsonException() << "Not an unsigned integer"; - + return GetUInteger(); } - + double TJsonValue::GetDoubleSafe() const { if (!IsDouble()) ythrow TJsonException() << "Not a double"; - + return GetDouble(); } - + const TString& TJsonValue::GetStringSafe() const { if (Type != JSON_STRING) ythrow TJsonException() << "Not a string"; - + return Value.String; } - + bool TJsonValue::GetBooleanSafe(const bool defaultValue) const { if (Type == JSON_UNDEFINED) return defaultValue; @@ -497,10 +497,10 @@ namespace NJson { const TJsonValue::TMapType& TJsonValue::GetMapSafe() const { if (Type != JSON_MAP) ythrow TJsonException() << "Not a map"; - + return *Value.Map; } - + TJsonValue::TMapType& TJsonValue::GetMapSafe() { return const_cast<TJsonValue::TMapType&>(const_cast<const TJsonValue*>(this)->GetMapSafe()); } @@ -508,10 +508,10 @@ namespace NJson { const TJsonValue::TArray& TJsonValue::GetArraySafe() const { if (Type != JSON_ARRAY) ythrow TJsonException() << "Not an array"; - + return *Value.Array; } - + TJsonValue::TArray& TJsonValue::GetArraySafe() { return const_cast<TJsonValue::TArray&>(const_cast<const TJsonValue*>(this)->GetArraySafe()); } diff --git a/library/cpp/json/writer/json_value.h b/library/cpp/json/writer/json_value.h index b634613f26..3f0f50bc4c 100644 --- a/library/cpp/json/writer/json_value.h +++ b/library/cpp/json/writer/json_value.h @@ -129,7 +129,7 @@ namespace NJson { unsigned long long GetUIntegerSafe(unsigned long long defaultValue) const; double GetDoubleSafe(double defaultValue) const; TString GetStringSafe(const TString& defaultValue) const; - + bool GetBooleanRobust() const noexcept; long long GetIntegerRobust() const noexcept; unsigned long long GetUIntegerRobust() const noexcept; |