ICU4X
International Components for Unicode
Loading...
Searching...
No Matches
TimeZone.hpp
Go to the documentation of this file.
1#ifndef ICU4X_TimeZone_HPP
2#define ICU4X_TimeZone_HPP
3
4#include "TimeZone.d.hpp"
5
6#include <stdio.h>
7#include <stdint.h>
8#include <stddef.h>
9#include <stdbool.h>
10#include <memory>
11#include <functional>
12#include <optional>
13#include <cstdlib>
14#include "TimeZoneInfo.hpp"
15#include "UtcOffset.hpp"
16#include "diplomat_runtime.hpp"
17
18
19namespace icu4x {
20namespace capi {
21 extern "C" {
22
23 icu4x::capi::TimeZone* icu4x_TimeZone_unknown_mv1(void);
24
25 bool icu4x_TimeZone_is_unknown_mv1(const icu4x::capi::TimeZone* self);
26
27 icu4x::capi::TimeZone* icu4x_TimeZone_create_from_iana_id_mv1(icu4x::diplomat::capi::DiplomatStringView iana_id);
28
29 icu4x::capi::TimeZone* icu4x_TimeZone_create_from_windows_id_mv1(icu4x::diplomat::capi::DiplomatStringView windows_id, icu4x::diplomat::capi::DiplomatStringView region);
30
31 icu4x::capi::TimeZone* icu4x_TimeZone_create_from_system_id_mv1(icu4x::diplomat::capi::DiplomatStringView id, icu4x::diplomat::capi::DiplomatStringView _region);
32
33 icu4x::capi::TimeZone* icu4x_TimeZone_create_from_bcp47_mv1(icu4x::diplomat::capi::DiplomatStringView id);
34
35 icu4x::capi::TimeZoneInfo* icu4x_TimeZone_with_offset_mv1(const icu4x::capi::TimeZone* self, const icu4x::capi::UtcOffset* offset);
36
37 icu4x::capi::TimeZoneInfo* icu4x_TimeZone_without_offset_mv1(const icu4x::capi::TimeZone* self);
38
39 void icu4x_TimeZone_destroy_mv1(TimeZone* self);
40
41 } // extern "C"
42} // namespace capi
43} // namespace
44
45inline std::unique_ptr<icu4x::TimeZone> icu4x::TimeZone::unknown() {
46 auto result = icu4x::capi::icu4x_TimeZone_unknown_mv1();
47 return std::unique_ptr<icu4x::TimeZone>(icu4x::TimeZone::FromFFI(result));
48}
49
50inline bool icu4x::TimeZone::is_unknown() const {
51 auto result = icu4x::capi::icu4x_TimeZone_is_unknown_mv1(this->AsFFI());
52 return result;
53}
54
55inline std::unique_ptr<icu4x::TimeZone> icu4x::TimeZone::create_from_iana_id(std::string_view iana_id) {
56 auto result = icu4x::capi::icu4x_TimeZone_create_from_iana_id_mv1({iana_id.data(), iana_id.size()});
57 return std::unique_ptr<icu4x::TimeZone>(icu4x::TimeZone::FromFFI(result));
58}
59
60inline std::unique_ptr<icu4x::TimeZone> icu4x::TimeZone::create_from_windows_id(std::string_view windows_id, std::string_view region) {
61 auto result = icu4x::capi::icu4x_TimeZone_create_from_windows_id_mv1({windows_id.data(), windows_id.size()},
62 {region.data(), region.size()});
63 return std::unique_ptr<icu4x::TimeZone>(icu4x::TimeZone::FromFFI(result));
64}
65
66inline std::unique_ptr<icu4x::TimeZone> icu4x::TimeZone::create_from_system_id(std::string_view id, std::string_view _region) {
67 auto result = icu4x::capi::icu4x_TimeZone_create_from_system_id_mv1({id.data(), id.size()},
68 {_region.data(), _region.size()});
69 return std::unique_ptr<icu4x::TimeZone>(icu4x::TimeZone::FromFFI(result));
70}
71
72inline std::unique_ptr<icu4x::TimeZone> icu4x::TimeZone::create_from_bcp47(std::string_view id) {
73 auto result = icu4x::capi::icu4x_TimeZone_create_from_bcp47_mv1({id.data(), id.size()});
74 return std::unique_ptr<icu4x::TimeZone>(icu4x::TimeZone::FromFFI(result));
75}
76
77inline std::unique_ptr<icu4x::TimeZoneInfo> icu4x::TimeZone::with_offset(const icu4x::UtcOffset& offset) const {
78 auto result = icu4x::capi::icu4x_TimeZone_with_offset_mv1(this->AsFFI(),
79 offset.AsFFI());
80 return std::unique_ptr<icu4x::TimeZoneInfo>(icu4x::TimeZoneInfo::FromFFI(result));
81}
82
83inline std::unique_ptr<icu4x::TimeZoneInfo> icu4x::TimeZone::without_offset() const {
84 auto result = icu4x::capi::icu4x_TimeZone_without_offset_mv1(this->AsFFI());
85 return std::unique_ptr<icu4x::TimeZoneInfo>(icu4x::TimeZoneInfo::FromFFI(result));
86}
87
88inline const icu4x::capi::TimeZone* icu4x::TimeZone::AsFFI() const {
89 return reinterpret_cast<const icu4x::capi::TimeZone*>(this);
90}
91
92inline icu4x::capi::TimeZone* icu4x::TimeZone::AsFFI() {
93 return reinterpret_cast<icu4x::capi::TimeZone*>(this);
94}
95
96inline const icu4x::TimeZone* icu4x::TimeZone::FromFFI(const icu4x::capi::TimeZone* ptr) {
97 return reinterpret_cast<const icu4x::TimeZone*>(ptr);
98}
99
100inline icu4x::TimeZone* icu4x::TimeZone::FromFFI(icu4x::capi::TimeZone* ptr) {
101 return reinterpret_cast<icu4x::TimeZone*>(ptr);
102}
103
104inline void icu4x::TimeZone::operator delete(void* ptr) {
105 icu4x::capi::icu4x_TimeZone_destroy_mv1(reinterpret_cast<icu4x::capi::TimeZone*>(ptr));
106}
107
108
109#endif // ICU4X_TimeZone_HPP
static std::unique_ptr< icu4x::TimeZone > create_from_iana_id(std::string_view iana_id)
Definition TimeZone.hpp:55
static std::unique_ptr< icu4x::TimeZone > create_from_system_id(std::string_view id, std::string_view _region)
Definition TimeZone.hpp:66
std::unique_ptr< icu4x::TimeZoneInfo > without_offset() const
Definition TimeZone.hpp:83
bool is_unknown() const
Definition TimeZone.hpp:50
std::unique_ptr< icu4x::TimeZoneInfo > with_offset(const icu4x::UtcOffset &offset) const
Definition TimeZone.hpp:77
static std::unique_ptr< icu4x::TimeZone > create_from_bcp47(std::string_view id)
Definition TimeZone.hpp:72
static std::unique_ptr< icu4x::TimeZone > create_from_windows_id(std::string_view windows_id, std::string_view region)
Definition TimeZone.hpp:60
static std::unique_ptr< icu4x::TimeZone > unknown()
Definition TimeZone.hpp:45
Definition UtcOffset.d.hpp:31
Definition Bidi.d.hpp:13