| 1 |
#ifndef ICU4XCaseMapper_HPP |
| 2 |
#define ICU4XCaseMapper_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 "ICU4XCaseMapper.h" |
| 13 |
|
| 14 |
class ICU4XDataProvider; |
| 15 |
class ICU4XCaseMapper; |
| 16 |
#include "ICU4XError.hpp" |
| 17 |
class ICU4XLocale; |
| 18 |
struct ICU4XTitlecaseOptionsV1; |
| 19 |
class ICU4XCodePointSetBuilder; |
| 20 |
|
| 21 |
/** |
| 22 |
* A destruction policy for using ICU4XCaseMapper with std::unique_ptr. |
| 23 |
*/ |
| 24 |
struct ICU4XCaseMapperDeleter { |
| 25 |
void operator()(capi::ICU4XCaseMapper* l) const noexcept { |
| 26 |
capi::ICU4XCaseMapper_destroy(l); |
| 27 |
} |
| 28 |
}; |
| 29 |
|
| 30 |
/** |
| 31 |
* See the [Rust documentation for `CaseMapper`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html) for more information. |
| 32 |
*/ |
| 33 |
class ICU4XCaseMapper { |
| 34 |
public: |
| 35 |
|
| 36 |
/** |
| 37 |
* Construct a new ICU4XCaseMapper instance |
| 38 |
* |
| 39 |
* See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.new) for more information. |
| 40 |
*/ |
| 41 |
static diplomat::result<ICU4XCaseMapper, ICU4XError> create(const ICU4XDataProvider& provider); |
| 42 |
|
| 43 |
/** |
| 44 |
* Returns the full lowercase mapping of the given string |
| 45 |
* |
| 46 |
* See the [Rust documentation for `lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.lowercase) for more information. |
| 47 |
*/ |
| 48 |
template<typename W> diplomat::result<std::monostate, ICU4XError> lowercase_to_writeable(const std::string_view s, const ICU4XLocale& locale, W& write) const; |
| 49 |
|
| 50 |
/** |
| 51 |
* Returns the full lowercase mapping of the given string |
| 52 |
* |
| 53 |
* See the [Rust documentation for `lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.lowercase) for more information. |
| 54 |
*/ |
| 55 |
diplomat::result<std::string, ICU4XError> lowercase(const std::string_view s, const ICU4XLocale& locale) const; |
| 56 |
|
| 57 |
/** |
| 58 |
* Returns the full uppercase mapping of the given string |
| 59 |
* |
| 60 |
* See the [Rust documentation for `uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.uppercase) for more information. |
| 61 |
*/ |
| 62 |
template<typename W> diplomat::result<std::monostate, ICU4XError> uppercase_to_writeable(const std::string_view s, const ICU4XLocale& locale, W& write) const; |
| 63 |
|
| 64 |
/** |
| 65 |
* Returns the full uppercase mapping of the given string |
| 66 |
* |
| 67 |
* See the [Rust documentation for `uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.uppercase) for more information. |
| 68 |
*/ |
| 69 |
diplomat::result<std::string, ICU4XError> uppercase(const std::string_view s, const ICU4XLocale& locale) const; |
| 70 |
|
| 71 |
/** |
| 72 |
* Returns the full titlecase mapping of the given string, performing head adjustment without |
| 73 |
* loading additional data. |
| 74 |
* (if head adjustment is enabled in the options) |
| 75 |
* |
| 76 |
* The `v1` refers to the version of the options struct, which may change as we add more options |
| 77 |
* |
| 78 |
* See the [Rust documentation for `titlecase_segment_with_only_case_data`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.titlecase_segment_with_only_case_data) for more information. |
| 79 |
*/ |
| 80 |
template<typename W> diplomat::result<std::monostate, ICU4XError> titlecase_segment_with_only_case_data_v1_to_writeable(const std::string_view s, const ICU4XLocale& locale, ICU4XTitlecaseOptionsV1 options, W& write) const; |
| 81 |
|
| 82 |
/** |
| 83 |
* Returns the full titlecase mapping of the given string, performing head adjustment without |
| 84 |
* loading additional data. |
| 85 |
* (if head adjustment is enabled in the options) |
| 86 |
* |
| 87 |
* The `v1` refers to the version of the options struct, which may change as we add more options |
| 88 |
* |
| 89 |
* See the [Rust documentation for `titlecase_segment_with_only_case_data`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.titlecase_segment_with_only_case_data) for more information. |
| 90 |
*/ |
| 91 |
diplomat::result<std::string, ICU4XError> titlecase_segment_with_only_case_data_v1(const std::string_view s, const ICU4XLocale& locale, ICU4XTitlecaseOptionsV1 options) const; |
| 92 |
|
| 93 |
/** |
| 94 |
* Case-folds the characters in the given string |
| 95 |
* |
| 96 |
* See the [Rust documentation for `fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.fold) for more information. |
| 97 |
*/ |
| 98 |
template<typename W> diplomat::result<std::monostate, ICU4XError> fold_to_writeable(const std::string_view s, W& write) const; |
| 99 |
|
| 100 |
/** |
| 101 |
* Case-folds the characters in the given string |
| 102 |
* |
| 103 |
* See the [Rust documentation for `fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.fold) for more information. |
| 104 |
*/ |
| 105 |
diplomat::result<std::string, ICU4XError> fold(const std::string_view s) const; |
| 106 |
|
| 107 |
/** |
| 108 |
* Case-folds the characters in the given string |
| 109 |
* using Turkic (T) mappings for dotted/dotless I. |
| 110 |
* |
| 111 |
* See the [Rust documentation for `fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.fold_turkic) for more information. |
| 112 |
*/ |
| 113 |
template<typename W> diplomat::result<std::monostate, ICU4XError> fold_turkic_to_writeable(const std::string_view s, W& write) const; |
| 114 |
|
| 115 |
/** |
| 116 |
* Case-folds the characters in the given string |
| 117 |
* using Turkic (T) mappings for dotted/dotless I. |
| 118 |
* |
| 119 |
* See the [Rust documentation for `fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.fold_turkic) for more information. |
| 120 |
*/ |
| 121 |
diplomat::result<std::string, ICU4XError> fold_turkic(const std::string_view s) const; |
| 122 |
|
| 123 |
/** |
| 124 |
* Adds all simple case mappings and the full case folding for `c` to `builder`. |
| 125 |
* Also adds special case closure mappings. |
| 126 |
* |
| 127 |
* In other words, this adds all characters that this casemaps to, as |
| 128 |
* well as all characters that may casemap to this one. |
| 129 |
* |
| 130 |
* Note that since ICU4XCodePointSetBuilder does not contain strings, this will |
| 131 |
* ignore string mappings. |
| 132 |
* |
| 133 |
* Identical to the similarly named method on `ICU4XCaseMapCloser`, use that if you |
| 134 |
* plan on using string case closure mappings too. |
| 135 |
* |
| 136 |
* See the [Rust documentation for `add_case_closure_to`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.add_case_closure_to) for more information. |
| 137 |
*/ |
| 138 |
void add_case_closure_to(char32_t c, ICU4XCodePointSetBuilder& builder) const; |
| 139 |
|
| 140 |
/** |
| 141 |
* Returns the simple lowercase mapping of the given character. |
| 142 |
* |
| 143 |
* This function only implements simple and common mappings. |
| 144 |
* Full mappings, which can map one char to a string, are not included. |
| 145 |
* For full mappings, use `ICU4XCaseMapper::lowercase`. |
| 146 |
* |
| 147 |
* See the [Rust documentation for `simple_lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_lowercase) for more information. |
| 148 |
*/ |
| 149 |
char32_t simple_lowercase(char32_t ch) const; |
| 150 |
|
| 151 |
/** |
| 152 |
* Returns the simple uppercase mapping of the given character. |
| 153 |
* |
| 154 |
* This function only implements simple and common mappings. |
| 155 |
* Full mappings, which can map one char to a string, are not included. |
| 156 |
* For full mappings, use `ICU4XCaseMapper::uppercase`. |
| 157 |
* |
| 158 |
* See the [Rust documentation for `simple_uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_uppercase) for more information. |
| 159 |
*/ |
| 160 |
char32_t simple_uppercase(char32_t ch) const; |
| 161 |
|
| 162 |
/** |
| 163 |
* Returns the simple titlecase mapping of the given character. |
| 164 |
* |
| 165 |
* This function only implements simple and common mappings. |
| 166 |
* Full mappings, which can map one char to a string, are not included. |
| 167 |
* For full mappings, use `ICU4XCaseMapper::titlecase_segment`. |
| 168 |
* |
| 169 |
* See the [Rust documentation for `simple_titlecase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_titlecase) for more information. |
| 170 |
*/ |
| 171 |
char32_t simple_titlecase(char32_t ch) const; |
| 172 |
|
| 173 |
/** |
| 174 |
* Returns the simple casefolding of the given character. |
| 175 |
* |
| 176 |
* This function only implements simple folding. |
| 177 |
* For full folding, use `ICU4XCaseMapper::fold`. |
| 178 |
* |
| 179 |
* See the [Rust documentation for `simple_fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_fold) for more information. |
| 180 |
*/ |
| 181 |
char32_t simple_fold(char32_t ch) const; |
| 182 |
|
| 183 |
/** |
| 184 |
* Returns the simple casefolding of the given character in the Turkic locale |
| 185 |
* |
| 186 |
* This function only implements simple folding. |
| 187 |
* For full folding, use `ICU4XCaseMapper::fold_turkic`. |
| 188 |
* |
| 189 |
* See the [Rust documentation for `simple_fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.simple_fold_turkic) for more information. |
| 190 |
*/ |
| 191 |
char32_t simple_fold_turkic(char32_t ch) const; |
| 192 |
inline const capi::ICU4XCaseMapper* AsFFI() const { return this->inner.get(); } |
| 193 |
inline capi::ICU4XCaseMapper* AsFFIMut() { return this->inner.get(); } |
| 194 |
inline explicit ICU4XCaseMapper(capi::ICU4XCaseMapper* i) : inner(i) {} |
| 195 |
ICU4XCaseMapper() = default; |
| 196 |
ICU4XCaseMapper(ICU4XCaseMapper&&) noexcept = default; |
| 197 |
ICU4XCaseMapper& operator=(ICU4XCaseMapper&& other) noexcept = default; |
| 198 |
private: |
| 199 |
std::unique_ptr<capi::ICU4XCaseMapper, ICU4XCaseMapperDeleter> inner; |
| 200 |
}; |
| 201 |
|
| 202 |
#include "ICU4XDataProvider.hpp" |
| 203 |
#include "ICU4XLocale.hpp" |
| 204 |
#include "ICU4XTitlecaseOptionsV1.hpp" |
| 205 |
#include "ICU4XCodePointSetBuilder.hpp" |
| 206 |
|
| 207 |
inline diplomat::result<ICU4XCaseMapper, ICU4XError> ICU4XCaseMapper::create(const ICU4XDataProvider& provider) { |
| 208 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_create(provider.AsFFI()); |
| 209 |
diplomat::result<ICU4XCaseMapper, ICU4XError> diplomat_result_out_value; |
| 210 |
if (diplomat_result_raw_out_value.is_ok) { |
| 211 |
diplomat_result_out_value = diplomat::Ok<ICU4XCaseMapper>(ICU4XCaseMapper(diplomat_result_raw_out_value.ok)); |
| 212 |
} else { |
| 213 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 214 |
} |
| 215 |
return diplomat_result_out_value; |
| 216 |
} |
| 217 |
template<typename W> inline diplomat::result<std::monostate, ICU4XError> ICU4XCaseMapper::lowercase_to_writeable(const std::string_view s, const ICU4XLocale& locale, W& write) const { |
| 218 |
capi::DiplomatWriteable write_writer = diplomat::WriteableTrait<W>::Construct(write); |
| 219 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_lowercase(this->inner.get(), s.data(), s.size(), locale.AsFFI(), &write_writer); |
| 220 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 221 |
if (diplomat_result_raw_out_value.is_ok) { |
| 222 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 223 |
} else { |
| 224 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 225 |
} |
| 226 |
return diplomat_result_out_value; |
| 227 |
} |
| 228 |
inline diplomat::result<std::string, ICU4XError> ICU4XCaseMapper::lowercase(const std::string_view s, const ICU4XLocale& locale) const { |
| 229 |
std::string diplomat_writeable_string; |
| 230 |
capi::DiplomatWriteable diplomat_writeable_out = diplomat::WriteableFromString(diplomat_writeable_string); |
| 231 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_lowercase(this->inner.get(), s.data(), s.size(), locale.AsFFI(), &diplomat_writeable_out); |
| 232 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 233 |
if (diplomat_result_raw_out_value.is_ok) { |
| 234 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 235 |
} else { |
| 236 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 237 |
} |
| 238 |
return diplomat_result_out_value.replace_ok(std::move(diplomat_writeable_string)); |
| 239 |
} |
| 240 |
template<typename W> inline diplomat::result<std::monostate, ICU4XError> ICU4XCaseMapper::uppercase_to_writeable(const std::string_view s, const ICU4XLocale& locale, W& write) const { |
| 241 |
capi::DiplomatWriteable write_writer = diplomat::WriteableTrait<W>::Construct(write); |
| 242 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_uppercase(this->inner.get(), s.data(), s.size(), locale.AsFFI(), &write_writer); |
| 243 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 244 |
if (diplomat_result_raw_out_value.is_ok) { |
| 245 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 246 |
} else { |
| 247 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 248 |
} |
| 249 |
return diplomat_result_out_value; |
| 250 |
} |
| 251 |
inline diplomat::result<std::string, ICU4XError> ICU4XCaseMapper::uppercase(const std::string_view s, const ICU4XLocale& locale) const { |
| 252 |
std::string diplomat_writeable_string; |
| 253 |
capi::DiplomatWriteable diplomat_writeable_out = diplomat::WriteableFromString(diplomat_writeable_string); |
| 254 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_uppercase(this->inner.get(), s.data(), s.size(), locale.AsFFI(), &diplomat_writeable_out); |
| 255 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 256 |
if (diplomat_result_raw_out_value.is_ok) { |
| 257 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 258 |
} else { |
| 259 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 260 |
} |
| 261 |
return diplomat_result_out_value.replace_ok(std::move(diplomat_writeable_string)); |
| 262 |
} |
| 263 |
template<typename W> inline diplomat::result<std::monostate, ICU4XError> ICU4XCaseMapper::titlecase_segment_with_only_case_data_v1_to_writeable(const std::string_view s, const ICU4XLocale& locale, ICU4XTitlecaseOptionsV1 options, W& write) const { |
| 264 |
ICU4XTitlecaseOptionsV1 diplomat_wrapped_struct_options = options; |
| 265 |
capi::DiplomatWriteable write_writer = diplomat::WriteableTrait<W>::Construct(write); |
| 266 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_titlecase_segment_with_only_case_data_v1(this->inner.get(), s.data(), s.size(), locale.AsFFI(), capi::ICU4XTitlecaseOptionsV1{ .leading_adjustment = static_cast<capi::ICU4XLeadingAdjustment>(diplomat_wrapped_struct_options.leading_adjustment), .trailing_case = static_cast<capi::ICU4XTrailingCase>(diplomat_wrapped_struct_options.trailing_case) }, &write_writer); |
| 267 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 268 |
if (diplomat_result_raw_out_value.is_ok) { |
| 269 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 270 |
} else { |
| 271 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 272 |
} |
| 273 |
return diplomat_result_out_value; |
| 274 |
} |
| 275 |
inline diplomat::result<std::string, ICU4XError> ICU4XCaseMapper::titlecase_segment_with_only_case_data_v1(const std::string_view s, const ICU4XLocale& locale, ICU4XTitlecaseOptionsV1 options) const { |
| 276 |
ICU4XTitlecaseOptionsV1 diplomat_wrapped_struct_options = options; |
| 277 |
std::string diplomat_writeable_string; |
| 278 |
capi::DiplomatWriteable diplomat_writeable_out = diplomat::WriteableFromString(diplomat_writeable_string); |
| 279 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_titlecase_segment_with_only_case_data_v1(this->inner.get(), s.data(), s.size(), locale.AsFFI(), capi::ICU4XTitlecaseOptionsV1{ .leading_adjustment = static_cast<capi::ICU4XLeadingAdjustment>(diplomat_wrapped_struct_options.leading_adjustment), .trailing_case = static_cast<capi::ICU4XTrailingCase>(diplomat_wrapped_struct_options.trailing_case) }, &diplomat_writeable_out); |
| 280 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 281 |
if (diplomat_result_raw_out_value.is_ok) { |
| 282 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 283 |
} else { |
| 284 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 285 |
} |
| 286 |
return diplomat_result_out_value.replace_ok(std::move(diplomat_writeable_string)); |
| 287 |
} |
| 288 |
template<typename W> inline diplomat::result<std::monostate, ICU4XError> ICU4XCaseMapper::fold_to_writeable(const std::string_view s, W& write) const { |
| 289 |
capi::DiplomatWriteable write_writer = diplomat::WriteableTrait<W>::Construct(write); |
| 290 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_fold(this->inner.get(), s.data(), s.size(), &write_writer); |
| 291 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 292 |
if (diplomat_result_raw_out_value.is_ok) { |
| 293 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 294 |
} else { |
| 295 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 296 |
} |
| 297 |
return diplomat_result_out_value; |
| 298 |
} |
| 299 |
inline diplomat::result<std::string, ICU4XError> ICU4XCaseMapper::fold(const std::string_view s) const { |
| 300 |
std::string diplomat_writeable_string; |
| 301 |
capi::DiplomatWriteable diplomat_writeable_out = diplomat::WriteableFromString(diplomat_writeable_string); |
| 302 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_fold(this->inner.get(), s.data(), s.size(), &diplomat_writeable_out); |
| 303 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 304 |
if (diplomat_result_raw_out_value.is_ok) { |
| 305 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 306 |
} else { |
| 307 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 308 |
} |
| 309 |
return diplomat_result_out_value.replace_ok(std::move(diplomat_writeable_string)); |
| 310 |
} |
| 311 |
template<typename W> inline diplomat::result<std::monostate, ICU4XError> ICU4XCaseMapper::fold_turkic_to_writeable(const std::string_view s, W& write) const { |
| 312 |
capi::DiplomatWriteable write_writer = diplomat::WriteableTrait<W>::Construct(write); |
| 313 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_fold_turkic(this->inner.get(), s.data(), s.size(), &write_writer); |
| 314 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 315 |
if (diplomat_result_raw_out_value.is_ok) { |
| 316 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 317 |
} else { |
| 318 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 319 |
} |
| 320 |
return diplomat_result_out_value; |
| 321 |
} |
| 322 |
inline diplomat::result<std::string, ICU4XError> ICU4XCaseMapper::fold_turkic(const std::string_view s) const { |
| 323 |
std::string diplomat_writeable_string; |
| 324 |
capi::DiplomatWriteable diplomat_writeable_out = diplomat::WriteableFromString(diplomat_writeable_string); |
| 325 |
auto diplomat_result_raw_out_value = capi::ICU4XCaseMapper_fold_turkic(this->inner.get(), s.data(), s.size(), &diplomat_writeable_out); |
| 326 |
diplomat::result<std::monostate, ICU4XError> diplomat_result_out_value; |
| 327 |
if (diplomat_result_raw_out_value.is_ok) { |
| 328 |
diplomat_result_out_value = diplomat::Ok<std::monostate>(std::monostate()); |
| 329 |
} else { |
| 330 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 331 |
} |
| 332 |
return diplomat_result_out_value.replace_ok(std::move(diplomat_writeable_string)); |
| 333 |
} |
| 334 |
inline void ICU4XCaseMapper::add_case_closure_to(char32_t c, ICU4XCodePointSetBuilder& builder) const { |
| 335 |
capi::ICU4XCaseMapper_add_case_closure_to(this->inner.get(), c, builder.AsFFIMut()); |
| 336 |
} |
| 337 |
inline char32_t ICU4XCaseMapper::simple_lowercase(char32_t ch) const { |
| 338 |
return capi::ICU4XCaseMapper_simple_lowercase(this->inner.get(), ch); |
| 339 |
} |
| 340 |
inline char32_t ICU4XCaseMapper::simple_uppercase(char32_t ch) const { |
| 341 |
return capi::ICU4XCaseMapper_simple_uppercase(this->inner.get(), ch); |
| 342 |
} |
| 343 |
inline char32_t ICU4XCaseMapper::simple_titlecase(char32_t ch) const { |
| 344 |
return capi::ICU4XCaseMapper_simple_titlecase(this->inner.get(), ch); |
| 345 |
} |
| 346 |
inline char32_t ICU4XCaseMapper::simple_fold(char32_t ch) const { |
| 347 |
return capi::ICU4XCaseMapper_simple_fold(this->inner.get(), ch); |
| 348 |
} |
| 349 |
inline char32_t ICU4XCaseMapper::simple_fold_turkic(char32_t ch) const { |
| 350 |
return capi::ICU4XCaseMapper_simple_fold_turkic(this->inner.get(), ch); |
| 351 |
} |
| 352 |
#endif |