1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
11 
12 #ifndef _LIBCPP___CHRONO_TZDB_LIST_H
13 #define _LIBCPP___CHRONO_TZDB_LIST_H
14 
15 #include <version>
16 // Enable the contents of the header only when libc++ was built with experimental features enabled.
17 #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
18 
19 #  include <__availability>
20 #  include <__chrono/tzdb.h>
21 #  include <forward_list>
22 #  include <string_view>
23 
24 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25 #    pragma GCC system_header
26 #  endif
27 
28 _LIBCPP_BEGIN_NAMESPACE_STD
29 
30 #  if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&   \
31       !defined(_LIBCPP_HAS_NO_LOCALIZATION)
32 
33 namespace chrono {
34 
35 class _LIBCPP_AVAILABILITY_TZDB tzdb_list {
36 public:
37   _LIBCPP_EXPORTED_FROM_ABI explicit tzdb_list(tzdb&& __tzdb);
38   _LIBCPP_EXPORTED_FROM_ABI ~tzdb_list();
39 
40   tzdb_list(const tzdb_list&)            = delete;
41   tzdb_list& operator=(const tzdb_list&) = delete;
42 
43   using const_iterator = forward_list<tzdb>::const_iterator;
44 
45   _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const tzdb& front() const noexcept;
46 
47   _LIBCPP_EXPORTED_FROM_ABI const_iterator erase_after(const_iterator __p);
48 
49   _LIBCPP_EXPORTED_FROM_ABI tzdb& __emplace_front(tzdb&& __tzdb);
50 
51   _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const_iterator begin() const noexcept;
52   _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const_iterator end() const noexcept;
53 
54   _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const_iterator cbegin() const noexcept;
55   _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const_iterator cend() const noexcept;
56 
57 private:
58   class __impl;
59   __impl* __impl_;
60 };
61 
62 _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI tzdb_list& get_tzdb_list();
63 
64 _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI inline const tzdb& get_tzdb() {
65   return get_tzdb_list().front();
66 }
67 
68 _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb();
69 
70 _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version();
71 
72 } // namespace chrono
73 
74 #  endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
75          // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
76 
77 _LIBCPP_END_NAMESPACE_STD
78 
79 #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
80 
81 #endif // _LIBCPP___CHRONO_TZDB_LIST_H
82