| 1 |
#ifndef ICU4XScriptWithExtensionsBorrowed_HPP |
| 2 |
#define ICU4XScriptWithExtensionsBorrowed_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 "ICU4XScriptWithExtensionsBorrowed.h" |
| 13 |
|
| 14 |
class ICU4XScriptExtensionsSet; |
| 15 |
class ICU4XCodePointSetData; |
| 16 |
|
| 17 |
/** |
| 18 |
* A destruction policy for using ICU4XScriptWithExtensionsBorrowed with std::unique_ptr. |
| 19 |
*/ |
| 20 |
struct ICU4XScriptWithExtensionsBorrowedDeleter { |
| 21 |
void operator()(capi::ICU4XScriptWithExtensionsBorrowed* l) const noexcept { |
| 22 |
capi::ICU4XScriptWithExtensionsBorrowed_destroy(l); |
| 23 |
} |
| 24 |
}; |
| 25 |
|
| 26 |
/** |
| 27 |
* A slightly faster ICU4XScriptWithExtensions object |
| 28 |
* |
| 29 |
* See the [Rust documentation for `ScriptWithExtensionsBorrowed`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html) for more information. |
| 30 |
*/ |
| 31 |
class ICU4XScriptWithExtensionsBorrowed { |
| 32 |
public: |
| 33 |
|
| 34 |
/** |
| 35 |
* Get the Script property value for a code point |
| 36 |
* |
| 37 |
* See the [Rust documentation for `get_script_val`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_val) for more information. |
| 38 |
*/ |
| 39 |
uint16_t get_script_val(uint32_t code_point) const; |
| 40 |
|
| 41 |
/** |
| 42 |
* Get the Script property value for a code point |
| 43 |
* |
| 44 |
* See the [Rust documentation for `get_script_extensions_val`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_extensions_val) for more information. |
| 45 |
* |
| 46 |
* Lifetimes: `this` must live at least as long as the output. |
| 47 |
*/ |
| 48 |
ICU4XScriptExtensionsSet get_script_extensions_val(uint32_t code_point) const; |
| 49 |
|
| 50 |
/** |
| 51 |
* Check if the Script_Extensions property of the given code point covers the given script |
| 52 |
* |
| 53 |
* See the [Rust documentation for `has_script`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.has_script) for more information. |
| 54 |
*/ |
| 55 |
bool has_script(uint32_t code_point, uint16_t script) const; |
| 56 |
|
| 57 |
/** |
| 58 |
* Build the CodePointSetData corresponding to a codepoints matching a particular script |
| 59 |
* in their Script_Extensions |
| 60 |
* |
| 61 |
* See the [Rust documentation for `get_script_extensions_set`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html#method.get_script_extensions_set) for more information. |
| 62 |
*/ |
| 63 |
ICU4XCodePointSetData get_script_extensions_set(uint16_t script) const; |
| 64 |
inline const capi::ICU4XScriptWithExtensionsBorrowed* AsFFI() const { return this->inner.get(); } |
| 65 |
inline capi::ICU4XScriptWithExtensionsBorrowed* AsFFIMut() { return this->inner.get(); } |
| 66 |
inline explicit ICU4XScriptWithExtensionsBorrowed(capi::ICU4XScriptWithExtensionsBorrowed* i) : inner(i) {} |
| 67 |
ICU4XScriptWithExtensionsBorrowed() = default; |
| 68 |
ICU4XScriptWithExtensionsBorrowed(ICU4XScriptWithExtensionsBorrowed&&) noexcept = default; |
| 69 |
ICU4XScriptWithExtensionsBorrowed& operator=(ICU4XScriptWithExtensionsBorrowed&& other) noexcept = default; |
| 70 |
private: |
| 71 |
std::unique_ptr<capi::ICU4XScriptWithExtensionsBorrowed, ICU4XScriptWithExtensionsBorrowedDeleter> inner; |
| 72 |
}; |
| 73 |
|
| 74 |
#include "ICU4XScriptExtensionsSet.hpp" |
| 75 |
#include "ICU4XCodePointSetData.hpp" |
| 76 |
|
| 77 |
inline uint16_t ICU4XScriptWithExtensionsBorrowed::get_script_val(uint32_t code_point) const { |
| 78 |
return capi::ICU4XScriptWithExtensionsBorrowed_get_script_val(this->inner.get(), code_point); |
| 79 |
} |
| 80 |
inline ICU4XScriptExtensionsSet ICU4XScriptWithExtensionsBorrowed::get_script_extensions_val(uint32_t code_point) const { |
| 81 |
return ICU4XScriptExtensionsSet(capi::ICU4XScriptWithExtensionsBorrowed_get_script_extensions_val(this->inner.get(), code_point)); |
| 82 |
} |
| 83 |
inline bool ICU4XScriptWithExtensionsBorrowed::has_script(uint32_t code_point, uint16_t script) const { |
| 84 |
return capi::ICU4XScriptWithExtensionsBorrowed_has_script(this->inner.get(), code_point, script); |
| 85 |
} |
| 86 |
inline ICU4XCodePointSetData ICU4XScriptWithExtensionsBorrowed::get_script_extensions_set(uint16_t script) const { |
| 87 |
return ICU4XCodePointSetData(capi::ICU4XScriptWithExtensionsBorrowed_get_script_extensions_set(this->inner.get(), script)); |
| 88 |
} |
| 89 |
#endif |