diff options
author | insight <insight@yandex-team.ru> | 2022-02-10 16:46:59 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:59 +0300 |
commit | 3649e6106e994e7f969877e4b10207d3556454b2 (patch) | |
tree | 85a83202be3b025c776e8de41d80135483e7300f /library/cpp | |
parent | 55fa8c7df8dba9a6fda8a807e529a9d04bd88580 (diff) | |
download | ydb-3649e6106e994e7f969877e4b10207d3556454b2.tar.gz |
Restoring authorship annotation for <insight@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/object_factory/object_factory.h | 16 | ||||
-rw-r--r-- | library/cpp/yson/node/node.cpp | 18 | ||||
-rw-r--r-- | library/cpp/yson/node/node.h | 2 |
3 files changed, 18 insertions, 18 deletions
diff --git a/library/cpp/object_factory/object_factory.h b/library/cpp/object_factory/object_factory.h index 96cc11bcfd..a389f7b651 100644 --- a/library/cpp/object_factory/object_factory.h +++ b/library/cpp/object_factory/object_factory.h @@ -23,7 +23,7 @@ namespace NObjectFactory { virtual ~IFactoryObjectCreator() { } }; - + #define FACTORY_OBJECT_NAME(Name) \ static TString GetTypeName() { \ return #Name; \ @@ -31,7 +31,7 @@ namespace NObjectFactory { virtual TString GetType() const override { \ return #Name; \ } - + template <class TBaseProduct, class TDerivedProduct, class... TArgs> class TFactoryObjectCreator: public IFactoryObjectCreator<TBaseProduct, TArgs...> { TDerivedProduct* Create(TArgs... args) const override { @@ -45,13 +45,13 @@ namespace NObjectFactory { return new TDerivedProduct(); } }; - + template <class P, class K, class... TArgs> class IObjectFactory { public: typedef P TProduct; typedef K TKey; - + public: template <class TDerivedProduct> void Register(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) { @@ -102,7 +102,7 @@ namespace NObjectFactory { IFactoryObjectCreator<TProduct, void>* creator = IObjectFactory<TProduct, TKey, void>::GetCreator(key); return creator == nullptr ? nullptr : creator->Create(); } - + static TString KeysDebugString() { TSet<TString> keys; Singleton<TObjectFactory<TProduct, TKey>>()->GetKeys(keys); @@ -112,7 +112,7 @@ namespace NObjectFactory { } return keysStr; } - + static TProduct* Construct(const TKey& key, const TKey& defKey) { TProduct* result = Singleton<TObjectFactory<TProduct, TKey>>()->Create(key); if (!result && !!defKey) { @@ -195,7 +195,7 @@ namespace NObjectFactory { static TProduct* Construct(const TKey& key, TArgs... args) { return Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->Create(key, std::forward<TArgs>(args)...); } - + template <class... Args> static THolder<TProduct> VerifiedConstruct(Args&&... args) { auto result = MakeHolder(std::forward<Args>(args)...); @@ -211,7 +211,7 @@ namespace NObjectFactory { static void GetRegisteredKeys(TSet<TKey>& keys) { return Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->GetKeys(keys); } - + static TSet<TKey> GetRegisteredKeys() { TSet<TKey> keys; Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->GetKeys(keys); diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp index b39e070718..b38c32357a 100644 --- a/library/cpp/yson/node/node.cpp +++ b/library/cpp/yson/node/node.cpp @@ -540,17 +540,17 @@ TNode& TNode::operator[](const TStringBuf key) return std::get<TMapType>(Value_)[key]; } -const TNode& TNode::At(const TStringBuf key) const { - CheckType(Map); +const TNode& TNode::At(const TStringBuf key) const { + CheckType(Map); const auto& map = std::get<TMapType>(Value_); - TMapType::const_iterator i = map.find(key); - if (i == map.end()) { + TMapType::const_iterator i = map.find(key); + if (i == map.end()) { ythrow TLookupError() << "Cannot find key " << key; - } else { - return i->second; - } -} - + } else { + return i->second; + } +} + TNode& TNode::At(const TStringBuf key) { CheckType(Map); auto& map = std::get<TMapType>(Value_); diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h index 5f90f95df0..c51f177e97 100644 --- a/library/cpp/yson/node/node.h +++ b/library/cpp/yson/node/node.h @@ -202,7 +202,7 @@ public: const TNode& operator[](const TStringBuf key) const; TNode& operator[](const TStringBuf key); - const TNode& At(const TStringBuf key) const; + const TNode& At(const TStringBuf key) const; TNode& At(const TStringBuf key); // map getters |