Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:25

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 // For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
0011 
0012 #ifndef _LIBCPP___CXX03___CHRONO_TZDB_LIST_H
0013 #define _LIBCPP___CXX03___CHRONO_TZDB_LIST_H
0014 
0015 #include <__cxx03/version>
0016 // Enable the contents of the header only when libc++ was built with experimental features enabled.
0017 #if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
0018 
0019 #  include <__cxx03/__chrono/time_zone.h>
0020 #  include <__cxx03/__chrono/tzdb.h>
0021 #  include <__cxx03/__config>
0022 #  include <__cxx03/__fwd/string.h>
0023 #  include <__cxx03/forward_list>
0024 
0025 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0026 #    pragma GCC system_header
0027 #  endif
0028 
0029 _LIBCPP_BEGIN_NAMESPACE_STD
0030 
0031 #  if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&   \
0032       !defined(_LIBCPP_HAS_NO_LOCALIZATION)
0033 
0034 namespace chrono {
0035 
0036 // TODO TZDB
0037 // Libc++ recently switched to only export __ugly_names from the dylib.
0038 // Since the library is still experimental the functions in this header
0039 // should be adapted to this new style. The other tzdb headers should be
0040 // evaluated too.
0041 
0042 class _LIBCPP_AVAILABILITY_TZDB tzdb_list {
0043 public:
0044   class __impl; // public to allow construction in dylib
0045   _LIBCPP_HIDE_FROM_ABI explicit tzdb_list(__impl* __p) : __impl_(__p) {
0046     _LIBCPP_ASSERT_NON_NULL(__impl_ != nullptr, "initialized time_zone without a valid pimpl object");
0047   }
0048   _LIBCPP_EXPORTED_FROM_ABI ~tzdb_list();
0049 
0050   tzdb_list(const tzdb_list&)            = delete;
0051   tzdb_list& operator=(const tzdb_list&) = delete;
0052 
0053   using const_iterator = forward_list<tzdb>::const_iterator;
0054 
0055   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const tzdb& front() const noexcept { return __front(); }
0056 
0057   _LIBCPP_HIDE_FROM_ABI const_iterator erase_after(const_iterator __p) { return __erase_after(__p); }
0058 
0059   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const noexcept { return __begin(); }
0060   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const noexcept { return __end(); }
0061 
0062   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const noexcept { return __cbegin(); }
0063   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const noexcept { return __cend(); }
0064 
0065   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __impl& __implementation() { return *__impl_; }
0066 
0067 private:
0068   [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const tzdb& __front() const noexcept;
0069 
0070   _LIBCPP_EXPORTED_FROM_ABI const_iterator __erase_after(const_iterator __p);
0071 
0072   [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __begin() const noexcept;
0073   [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __end() const noexcept;
0074 
0075   [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __cbegin() const noexcept;
0076   [[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI const_iterator __cend() const noexcept;
0077 
0078   __impl* __impl_;
0079 };
0080 
0081 [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI tzdb_list& get_tzdb_list();
0082 
0083 [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const tzdb& get_tzdb() {
0084   return get_tzdb_list().front();
0085 }
0086 
0087 [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* locate_zone(string_view __name) {
0088   return get_tzdb().locate_zone(__name);
0089 }
0090 
0091 [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const time_zone* current_zone() {
0092   return get_tzdb().current_zone();
0093 }
0094 
0095 _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb();
0096 
0097 [[nodiscard]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version();
0098 
0099 } // namespace chrono
0100 
0101 #  endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
0102          // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
0103 
0104 _LIBCPP_END_NAMESPACE_STD
0105 
0106 #endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
0107 
0108 #endif // _LIBCPP___CXX03___CHRONO_TZDB_LIST_H