time_zone_if.cc
Go to the documentation of this file.
00001 // Copyright 2016 Google Inc. All Rights Reserved.
00002 //
00003 // Licensed under the Apache License, Version 2.0 (the "License");
00004 // you may not use this file except in compliance with the License.
00005 // You may obtain a copy of the License at
00006 //
00007 //   https://www.apache.org/licenses/LICENSE-2.0
00008 //
00009 //   Unless required by applicable law or agreed to in writing, software
00010 //   distributed under the License is distributed on an "AS IS" BASIS,
00011 //   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 //   See the License for the specific language governing permissions and
00013 //   limitations under the License.
00014 
00015 #include "time_zone_if.h"
00016 #include "time_zone_info.h"
00017 #include "time_zone_libc.h"
00018 
00019 namespace absl {
00020 namespace time_internal {
00021 namespace cctz {
00022 
00023 std::unique_ptr<TimeZoneIf> TimeZoneIf::Load(const std::string& name) {
00024   // Support "libc:localtime" and "libc:*" to access the legacy
00025   // localtime and UTC support respectively from the C library.
00026   if (name.compare(0, 5, "libc:") == 0) {
00027     return std::unique_ptr<TimeZoneIf>(new TimeZoneLibC(name.substr(5)));
00028   }
00029 
00030   // Otherwise use the "zoneinfo" implementation by default.
00031   std::unique_ptr<TimeZoneInfo> tz(new TimeZoneInfo);
00032   if (!tz->Load(name)) tz.reset();
00033   return std::unique_ptr<TimeZoneIf>(tz.release());
00034 }
00035 
00036 // Defined out-of-line to avoid emitting a weak vtable in all TUs.
00037 TimeZoneIf::~TimeZoneIf() {}
00038 
00039 }  // namespace cctz
00040 }  // namespace time_internal
00041 }  // namespace absl


abseil_cpp
Author(s):
autogenerated on Wed Jun 19 2019 19:42:15