ICU4X
International Components for Unicode
Loading...
Searching...
No Matches
ICU4XLocaleExpander.hpp
Go to the documentation of this file.
1#ifndef ICU4XLocaleExpander_HPP
2#define ICU4XLocaleExpander_HPP
3#include <stdint.h>
4#include <stddef.h>
5#include <stdbool.h>
6#include <algorithm>
7#include <memory>
8#include <variant>
9#include <optional>
10#include "diplomat_runtime.hpp"
11
12#include "ICU4XLocaleExpander.h"
13
16#include "ICU4XError.hpp"
17class ICU4XLocale;
19
23struct ICU4XLocaleExpanderDeleter {
24 void operator()(capi::ICU4XLocaleExpander* l) const noexcept {
25 capi::ICU4XLocaleExpander_destroy(l);
26 }
27};
28
35 public:
36
43
50
55
60
65 inline const capi::ICU4XLocaleExpander* AsFFI() const { return this->inner.get(); }
66 inline capi::ICU4XLocaleExpander* AsFFIMut() { return this->inner.get(); }
67 inline explicit ICU4XLocaleExpander(capi::ICU4XLocaleExpander* i) : inner(i) {}
70 ICU4XLocaleExpander& operator=(ICU4XLocaleExpander&& other) noexcept = default;
71 private:
72 std::unique_ptr<capi::ICU4XLocaleExpander, ICU4XLocaleExpanderDeleter> inner;
73};
74
75#include "ICU4XDataProvider.hpp"
76#include "ICU4XLocale.hpp"
77
79 auto diplomat_result_raw_out_value = capi::ICU4XLocaleExpander_create(provider.AsFFI());
81 if (diplomat_result_raw_out_value.is_ok) {
82 diplomat_result_out_value = diplomat::Ok<ICU4XLocaleExpander>(ICU4XLocaleExpander(diplomat_result_raw_out_value.ok));
83 } else {
84 diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err));
85 }
86 return diplomat_result_out_value;
87}
89 auto diplomat_result_raw_out_value = capi::ICU4XLocaleExpander_create_extended(provider.AsFFI());
91 if (diplomat_result_raw_out_value.is_ok) {
92 diplomat_result_out_value = diplomat::Ok<ICU4XLocaleExpander>(ICU4XLocaleExpander(diplomat_result_raw_out_value.ok));
93 } else {
94 diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err));
95 }
96 return diplomat_result_out_value;
97}
99 return static_cast<ICU4XTransformResult>(capi::ICU4XLocaleExpander_maximize(this->inner.get(), locale.AsFFIMut()));
100}
102 return static_cast<ICU4XTransformResult>(capi::ICU4XLocaleExpander_minimize(this->inner.get(), locale.AsFFIMut()));
103}
105 return static_cast<ICU4XTransformResult>(capi::ICU4XLocaleExpander_minimize_favor_script(this->inner.get(), locale.AsFFIMut()));
106}
107#endif
ICU4XError
Definition ICU4XError.hpp:23
ICU4XTransformResult
Definition ICU4XTransformResult.hpp:19
Definition ICU4XDataProvider.hpp:32
Definition ICU4XLocaleExpander.hpp:34
static diplomat::result< ICU4XLocaleExpander, ICU4XError > create(const ICU4XDataProvider &provider)
Definition ICU4XLocaleExpander.hpp:78
static diplomat::result< ICU4XLocaleExpander, ICU4XError > create_extended(const ICU4XDataProvider &provider)
Definition ICU4XLocaleExpander.hpp:88
ICU4XTransformResult maximize(ICU4XLocale &locale) const
Definition ICU4XLocaleExpander.hpp:98
ICU4XLocaleExpander(capi::ICU4XLocaleExpander *i)
Definition ICU4XLocaleExpander.hpp:67
ICU4XTransformResult minimize(ICU4XLocale &locale) const
Definition ICU4XLocaleExpander.hpp:101
ICU4XLocaleExpander()=default
ICU4XLocaleExpander(ICU4XLocaleExpander &&) noexcept=default
ICU4XTransformResult minimize_favor_script(ICU4XLocale &locale) const
Definition ICU4XLocaleExpander.hpp:104
Definition ICU4XLocale.hpp:32
Definition diplomat_runtime.hpp:84
Definition diplomat_runtime.hpp:69
Definition diplomat_runtime.hpp:55