2 //===----------------------------------------------------------------------===//
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
8 //===----------------------------------------------------------------------===//
10 // For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
12 #ifndef _LIBCPP___CHRONO_TZDB_LIST_H
13 #define _LIBCPP___CHRONO_TZDB_LIST_H
16 // Enable the contents of the header only when libc++ was built with experimental features enabled.
17 #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
19 # include <__availability>
20 # include <__chrono/tzdb.h>
21 # include <forward_list>
22 # include <string_view>
24 # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25 # pragma GCC system_header
28 _LIBCPP_BEGIN_NAMESPACE_STD
30 # if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
31 !defined(_LIBCPP_HAS_NO_LOCALIZATION)
35 class _LIBCPP_AVAILABILITY_TZDB tzdb_list
{
37 _LIBCPP_EXPORTED_FROM_ABI
explicit tzdb_list(tzdb
&& __tzdb
);
38 _LIBCPP_EXPORTED_FROM_ABI
~tzdb_list();
40 tzdb_list(const tzdb_list
&) = delete;
41 tzdb_list
& operator=(const tzdb_list
&) = delete;
43 using const_iterator
= forward_list
<tzdb
>::const_iterator
;
45 _LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI
const tzdb
& front() const noexcept
;
47 _LIBCPP_EXPORTED_FROM_ABI const_iterator
erase_after(const_iterator __p
);
49 _LIBCPP_EXPORTED_FROM_ABI tzdb
& __emplace_front(tzdb
&& __tzdb
);
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
;
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
;
62 _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI tzdb_list
& get_tzdb_list();
64 _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI
inline const tzdb
& get_tzdb() {
65 return get_tzdb_list().front();
68 _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI
const tzdb
& reload_tzdb();
70 _LIBCPP_NODISCARD_EXT _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string
remote_version();
74 # endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
75 // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
77 _LIBCPP_END_NAMESPACE_STD
79 #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_TZDB)
81 #endif // _LIBCPP___CHRONO_TZDB_LIST_H