diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/resource/resource.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/resource/resource.cpp')
-rw-r--r-- | library/cpp/resource/resource.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/resource/resource.cpp b/library/cpp/resource/resource.cpp index cc20f847a5..a8c2443662 100644 --- a/library/cpp/resource/resource.cpp +++ b/library/cpp/resource/resource.cpp @@ -1,52 +1,52 @@ +#include "resource.h" #include "resource.h" -#include "resource.h" -#include "registry.h" - -#include <util/generic/yexception.h> +#include "registry.h" + +#include <util/generic/yexception.h> #include <util/generic/xrange.h> - -using namespace NResource; - + +using namespace NResource; + bool NResource::FindExact(const TStringBuf key, TString* out) { - return CommonStore()->FindExact(key, out); -} - + return CommonStore()->FindExact(key, out); +} + void NResource::FindMatch(const TStringBuf subkey, TResources* out) { - struct TMatch: public IMatch { - inline TMatch(TResources* r) - : R(r) - { - } - + struct TMatch: public IMatch { + inline TMatch(TResources* r) + : R(r) + { + } + void OnMatch(const TResource& res) override { - R->push_back(res); - } - - TResources* R; - }; - - TMatch m(out); - - CommonStore()->FindMatch(subkey, m); -} - + R->push_back(res); + } + + TResources* R; + }; + + TMatch m(out); + + CommonStore()->FindMatch(subkey, m); +} + TString NResource::Find(const TStringBuf key) { TString ret; - - if (FindExact(key, &ret)) { - return ret; - } - - ythrow yexception() << "can not find resource with path " << key; -} - + + if (FindExact(key, &ret)) { + return ret; + } + + ythrow yexception() << "can not find resource with path " << key; +} + size_t NResource::Count() noexcept { - return CommonStore()->Count(); -} - -TStringBuf NResource::KeyByIndex(size_t idx) { - return CommonStore()->KeyByIndex(idx); -} + return CommonStore()->Count(); +} + +TStringBuf NResource::KeyByIndex(size_t idx) { + return CommonStore()->KeyByIndex(idx); +} TVector<TStringBuf> NResource::ListAllKeys() { TVector<TStringBuf> res(Reserve(NResource::Count())); |