ICU4X
International Components for Unicode
Loading...
Searching...
No Matches
ZonedTime.hpp
Go to the documentation of this file.
1#ifndef ICU4X_ZonedTime_HPP
2#define ICU4X_ZonedTime_HPP
3
4#include "ZonedTime.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 "IanaParser.hpp"
15#include "Rfc9557ParseError.hpp"
16#include "Time.hpp"
17#include "TimeZoneInfo.hpp"
18#include "diplomat_runtime.hpp"
19
20
21namespace icu4x {
22namespace capi {
23 extern "C" {
24
25 typedef struct icu4x_ZonedTime_strict_from_string_mv1_result {union {icu4x::capi::ZonedTime ok; icu4x::capi::Rfc9557ParseError err;}; bool is_ok;} icu4x_ZonedTime_strict_from_string_mv1_result;
26 icu4x_ZonedTime_strict_from_string_mv1_result icu4x_ZonedTime_strict_from_string_mv1(icu4x::diplomat::capi::DiplomatStringView v, const icu4x::capi::IanaParser* iana_parser);
27
28 typedef struct icu4x_ZonedTime_location_only_from_string_mv1_result {union {icu4x::capi::ZonedTime ok; icu4x::capi::Rfc9557ParseError err;}; bool is_ok;} icu4x_ZonedTime_location_only_from_string_mv1_result;
29 icu4x_ZonedTime_location_only_from_string_mv1_result icu4x_ZonedTime_location_only_from_string_mv1(icu4x::diplomat::capi::DiplomatStringView v, const icu4x::capi::IanaParser* iana_parser);
30
31 typedef struct icu4x_ZonedTime_offset_only_from_string_mv1_result {union {icu4x::capi::ZonedTime ok; icu4x::capi::Rfc9557ParseError err;}; bool is_ok;} icu4x_ZonedTime_offset_only_from_string_mv1_result;
32 icu4x_ZonedTime_offset_only_from_string_mv1_result icu4x_ZonedTime_offset_only_from_string_mv1(icu4x::diplomat::capi::DiplomatStringView v);
33
34 typedef struct icu4x_ZonedTime_lenient_from_string_mv1_result {union {icu4x::capi::ZonedTime ok; icu4x::capi::Rfc9557ParseError err;}; bool is_ok;} icu4x_ZonedTime_lenient_from_string_mv1_result;
35 icu4x_ZonedTime_lenient_from_string_mv1_result icu4x_ZonedTime_lenient_from_string_mv1(icu4x::diplomat::capi::DiplomatStringView v, const icu4x::capi::IanaParser* iana_parser);
36
37 } // extern "C"
38} // namespace capi
39} // namespace
40
42 auto result = icu4x::capi::icu4x_ZonedTime_strict_from_string_mv1({v.data(), v.size()},
43 iana_parser.AsFFI());
45}
46
48 auto result = icu4x::capi::icu4x_ZonedTime_location_only_from_string_mv1({v.data(), v.size()},
49 iana_parser.AsFFI());
51}
52
54 auto result = icu4x::capi::icu4x_ZonedTime_offset_only_from_string_mv1({v.data(), v.size()});
56}
57
59 auto result = icu4x::capi::icu4x_ZonedTime_lenient_from_string_mv1({v.data(), v.size()},
60 iana_parser.AsFFI());
62}
63
64
65inline icu4x::capi::ZonedTime icu4x::ZonedTime::AsFFI() const {
66 return icu4x::capi::ZonedTime {
67 /* .time = */ time->AsFFI(),
68 /* .zone = */ zone->AsFFI(),
69 };
70}
71
72inline icu4x::ZonedTime icu4x::ZonedTime::FromFFI(icu4x::capi::ZonedTime c_struct) {
73 return icu4x::ZonedTime {
74 /* .time = */ std::unique_ptr<icu4x::Time>(icu4x::Time::FromFFI(c_struct.time)),
75 /* .zone = */ std::unique_ptr<icu4x::TimeZoneInfo>(icu4x::TimeZoneInfo::FromFFI(c_struct.zone)),
76 };
77}
78
79
80#endif // ICU4X_ZonedTime_HPP
Definition IanaParser.d.hpp:42
Definition diplomat_runtime.hpp:166
bool is_ok() const
Definition diplomat_runtime.hpp:181
Definition Bidi.d.hpp:13
static icu4x::diplomat::result< icu4x::ZonedTime, icu4x::Rfc9557ParseError > lenient_from_string(std::string_view v, const icu4x::IanaParser &iana_parser)
Definition ZonedTime.hpp:58
static icu4x::diplomat::result< icu4x::ZonedTime, icu4x::Rfc9557ParseError > offset_only_from_string(std::string_view v)
Definition ZonedTime.hpp:53
static icu4x::diplomat::result< icu4x::ZonedTime, icu4x::Rfc9557ParseError > strict_from_string(std::string_view v, const icu4x::IanaParser &iana_parser)
Definition ZonedTime.hpp:41
static icu4x::diplomat::result< icu4x::ZonedTime, icu4x::Rfc9557ParseError > location_only_from_string(std::string_view v, const icu4x::IanaParser &iana_parser)
Definition ZonedTime.hpp:47
Definition diplomat_runtime.hpp:146
Definition diplomat_runtime.hpp:128