| 1 |
#ifndef ICU4XCanonicalCombiningClassMap_HPP |
| 2 |
#define ICU4XCanonicalCombiningClassMap_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 "ICU4XCanonicalCombiningClassMap.h" |
| 13 |
|
| 14 |
class ICU4XDataProvider; |
| 15 |
class ICU4XCanonicalCombiningClassMap; |
| 16 |
#include "ICU4XError.hpp" |
| 17 |
|
| 18 |
/** |
| 19 |
* A destruction policy for using ICU4XCanonicalCombiningClassMap with std::unique_ptr. |
| 20 |
*/ |
| 21 |
struct ICU4XCanonicalCombiningClassMapDeleter { |
| 22 |
void operator()(capi::ICU4XCanonicalCombiningClassMap* l) const noexcept { |
| 23 |
capi::ICU4XCanonicalCombiningClassMap_destroy(l); |
| 24 |
} |
| 25 |
}; |
| 26 |
|
| 27 |
/** |
| 28 |
* Lookup of the Canonical_Combining_Class Unicode property |
| 29 |
* |
| 30 |
* See the [Rust documentation for `CanonicalCombiningClassMap`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html) for more information. |
| 31 |
*/ |
| 32 |
class ICU4XCanonicalCombiningClassMap { |
| 33 |
public: |
| 34 |
|
| 35 |
/** |
| 36 |
* Construct a new ICU4XCanonicalCombiningClassMap instance for NFC |
| 37 |
* |
| 38 |
* See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.new) for more information. |
| 39 |
*/ |
| 40 |
static diplomat::result<ICU4XCanonicalCombiningClassMap, ICU4XError> create(const ICU4XDataProvider& provider); |
| 41 |
|
| 42 |
/** |
| 43 |
* See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.get) for more information. |
| 44 |
* |
| 45 |
* Additional information: [1](https://docs.rs/icu/latest/icu/properties/properties/struct.CanonicalCombiningClass.html) |
| 46 |
*/ |
| 47 |
uint8_t get(char32_t ch) const; |
| 48 |
|
| 49 |
/** |
| 50 |
* See the [Rust documentation for `get32`](https://docs.rs/icu/latest/icu/normalizer/properties/struct.CanonicalCombiningClassMap.html#method.get32) for more information. |
| 51 |
* |
| 52 |
* Additional information: [1](https://docs.rs/icu/latest/icu/properties/properties/struct.CanonicalCombiningClass.html) |
| 53 |
*/ |
| 54 |
uint8_t get32(uint32_t ch) const; |
| 55 |
inline const capi::ICU4XCanonicalCombiningClassMap* AsFFI() const { return this->inner.get(); } |
| 56 |
inline capi::ICU4XCanonicalCombiningClassMap* AsFFIMut() { return this->inner.get(); } |
| 57 |
inline explicit ICU4XCanonicalCombiningClassMap(capi::ICU4XCanonicalCombiningClassMap* i) : inner(i) {} |
| 58 |
ICU4XCanonicalCombiningClassMap() = default; |
| 59 |
ICU4XCanonicalCombiningClassMap(ICU4XCanonicalCombiningClassMap&&) noexcept = default; |
| 60 |
ICU4XCanonicalCombiningClassMap& operator=(ICU4XCanonicalCombiningClassMap&& other) noexcept = default; |
| 61 |
private: |
| 62 |
std::unique_ptr<capi::ICU4XCanonicalCombiningClassMap, ICU4XCanonicalCombiningClassMapDeleter> inner; |
| 63 |
}; |
| 64 |
|
| 65 |
#include "ICU4XDataProvider.hpp" |
| 66 |
|
| 67 |
inline diplomat::result<ICU4XCanonicalCombiningClassMap, ICU4XError> ICU4XCanonicalCombiningClassMap::create(const ICU4XDataProvider& provider) { |
| 68 |
auto diplomat_result_raw_out_value = capi::ICU4XCanonicalCombiningClassMap_create(provider.AsFFI()); |
| 69 |
diplomat::result<ICU4XCanonicalCombiningClassMap, ICU4XError> diplomat_result_out_value; |
| 70 |
if (diplomat_result_raw_out_value.is_ok) { |
| 71 |
diplomat_result_out_value = diplomat::Ok<ICU4XCanonicalCombiningClassMap>(ICU4XCanonicalCombiningClassMap(diplomat_result_raw_out_value.ok)); |
| 72 |
} else { |
| 73 |
diplomat_result_out_value = diplomat::Err<ICU4XError>(static_cast<ICU4XError>(diplomat_result_raw_out_value.err)); |
| 74 |
} |
| 75 |
return diplomat_result_out_value; |
| 76 |
} |
| 77 |
inline uint8_t ICU4XCanonicalCombiningClassMap::get(char32_t ch) const { |
| 78 |
return capi::ICU4XCanonicalCombiningClassMap_get(this->inner.get(), ch); |
| 79 |
} |
| 80 |
inline uint8_t ICU4XCanonicalCombiningClassMap::get32(uint32_t ch) const { |
| 81 |
return capi::ICU4XCanonicalCombiningClassMap_get32(this->inner.get(), ch); |
| 82 |
} |
| 83 |
#endif |