diff options
author | pmatsula <pmatsula@yandex-team.ru> | 2022-02-10 16:49:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:20 +0300 |
commit | 1278240bfbb8240f3c2d7a88085543f6bfaba73e (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/json/domscheme_traits.h | |
parent | b4c80a816aa1aafd8484de35b31cee234033ad59 (diff) | |
download | ydb-1278240bfbb8240f3c2d7a88085543f6bfaba73e.tar.gz |
Restoring authorship annotation for <pmatsula@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json/domscheme_traits.h')
-rw-r--r-- | library/cpp/json/domscheme_traits.h | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/json/domscheme_traits.h b/library/cpp/json/domscheme_traits.h index d2deba1104..a5a99cd8cf 100644 --- a/library/cpp/json/domscheme_traits.h +++ b/library/cpp/json/domscheme_traits.h @@ -6,32 +6,32 @@ #include <util/generic/algorithm.h> struct TJsonTraits { - using TValue = NJson::TJsonValue; - using TValueRef = TValue*; - using TConstValueRef = const TValue*; + using TValue = NJson::TJsonValue; + using TValueRef = TValue*; + using TConstValueRef = const TValue*; using TStringType = TStringBuf; - // anyvalue defaults - template <class T> - static inline TValue Value(T&& t) { - return TValue(std::forward<T>(t)); - } - - template <class T> - static inline TValue Value(std::initializer_list<T> t) { - TValue result(NJson::JSON_ARRAY); - result.GetArraySafe() = NJson::TJsonValue::TArray(t.begin(), t.end()); - return result; - } - - static inline TValueRef Ref(TValue& v) { - return &v; - } - - static inline TConstValueRef Ref(const TValue& v) { - return &v; - } - + // anyvalue defaults + template <class T> + static inline TValue Value(T&& t) { + return TValue(std::forward<T>(t)); + } + + template <class T> + static inline TValue Value(std::initializer_list<T> t) { + TValue result(NJson::JSON_ARRAY); + result.GetArraySafe() = NJson::TJsonValue::TArray(t.begin(), t.end()); + return result; + } + + static inline TValueRef Ref(TValue& v) { + return &v; + } + + static inline TConstValueRef Ref(const TValue& v) { + return &v; + } + // common ops static inline bool IsNull(TConstValueRef v) { return v->GetType() == NJson::JSON_UNDEFINED || v->IsNull(); @@ -60,13 +60,13 @@ struct TJsonTraits { v->SetType(NJson::JSON_ARRAY); } - using TArrayIterator = size_t; - - static inline TValueRef ArrayElement(TValueRef v, TArrayIterator n) { + using TArrayIterator = size_t; + + static inline TValueRef ArrayElement(TValueRef v, TArrayIterator n) { return &(*v)[n]; } - static inline TConstValueRef ArrayElement(TConstValueRef v, TArrayIterator n) { + static inline TConstValueRef ArrayElement(TConstValueRef v, TArrayIterator n) { return &(*v)[n]; } |