aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cctz/tzdata/factory.cpp
diff options
context:
space:
mode:
authorpetrk <petrk@yandex-team.ru>2022-02-10 16:47:26 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:26 +0300
commit1fe4b402b38f476dbe36f650c3049c92ae496d38 (patch)
tree9814fbd1c3effac9b8377c5d604b367b14e2db55 /contrib/libs/cctz/tzdata/factory.cpp
parentaf66956edf116b93d5a07894ccb61dd4447d0b34 (diff)
downloadydb-1fe4b402b38f476dbe36f650c3049c92ae496d38.tar.gz
Restoring authorship annotation for <petrk@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/cctz/tzdata/factory.cpp')
-rw-r--r--contrib/libs/cctz/tzdata/factory.cpp110
1 files changed, 55 insertions, 55 deletions
diff --git a/contrib/libs/cctz/tzdata/factory.cpp b/contrib/libs/cctz/tzdata/factory.cpp
index d7e1acc8b9..5a4b4a27b6 100644
--- a/contrib/libs/cctz/tzdata/factory.cpp
+++ b/contrib/libs/cctz/tzdata/factory.cpp
@@ -1,60 +1,60 @@
#include <contrib/libs/cctz/include/cctz/zone_info_source.h>
-
+
#include <library/cpp/resource/resource.h>
-
-#include <util/generic/string.h>
-#include <util/stream/str.h>
+
+#include <util/generic/string.h>
+#include <util/stream/str.h>
#include <util/string/builder.h>
-
-namespace cctz_extension {
- namespace {
-
- class TZoneInfoSource: public cctz::ZoneInfoSource {
- private:
- TZoneInfoSource(TString&& data)
- : TimeZoneData_(data)
- , Stream_(TimeZoneData_)
- {
- }
-
- public:
- static std::unique_ptr<cctz::ZoneInfoSource> LoadZone(const std::string& zoneName) {
+
+namespace cctz_extension {
+ namespace {
+
+ class TZoneInfoSource: public cctz::ZoneInfoSource {
+ private:
+ TZoneInfoSource(TString&& data)
+ : TimeZoneData_(data)
+ , Stream_(TimeZoneData_)
+ {
+ }
+
+ public:
+ static std::unique_ptr<cctz::ZoneInfoSource> LoadZone(const std::string& zoneName) {
TString resourceName = TStringBuilder() << "/cctz/tzdata/"sv << zoneName;
- TString tzData;
+ TString tzData;
if (!NResource::FindExact(resourceName, &tzData)) {
- return nullptr;
- }
- return std::unique_ptr<cctz::ZoneInfoSource>(new TZoneInfoSource(std::move(tzData)));
- }
-
- size_t Read(void* buf, size_t size) override {
- return Stream_.Read(buf, size);
- }
-
- int Skip(size_t offset) override {
- Stream_.Skip(offset);
- return 0;
- }
-
- private:
- const TString TimeZoneData_;
- TStringInput Stream_;
- };
-
- std::unique_ptr<cctz::ZoneInfoSource> CustomFactory(
- const std::string& name,
- const std::function<std::unique_ptr<cctz::ZoneInfoSource>(const std::string& name)>& /*fallback*/
- )
- {
- std::unique_ptr<cctz::ZoneInfoSource> zis = TZoneInfoSource::LoadZone(name);
- if (zis) {
- return zis;
- }
- return nullptr;
- }
-
- } // namespace
-
- ZoneInfoSourceFactory zone_info_source_factory = CustomFactory;
-
-} // namespace cctz_extension
+ return nullptr;
+ }
+ return std::unique_ptr<cctz::ZoneInfoSource>(new TZoneInfoSource(std::move(tzData)));
+ }
+
+ size_t Read(void* buf, size_t size) override {
+ return Stream_.Read(buf, size);
+ }
+
+ int Skip(size_t offset) override {
+ Stream_.Skip(offset);
+ return 0;
+ }
+
+ private:
+ const TString TimeZoneData_;
+ TStringInput Stream_;
+ };
+
+ std::unique_ptr<cctz::ZoneInfoSource> CustomFactory(
+ const std::string& name,
+ const std::function<std::unique_ptr<cctz::ZoneInfoSource>(const std::string& name)>& /*fallback*/
+ )
+ {
+ std::unique_ptr<cctz::ZoneInfoSource> zis = TZoneInfoSource::LoadZone(name);
+ if (zis) {
+ return zis;
+ }
+ return nullptr;
+ }
+
+ } // namespace
+
+ ZoneInfoSourceFactory zone_info_source_factory = CustomFactory;
+
+} // namespace cctz_extension