DecomposingNormalizer.d.hpp (5439B)
1 #ifndef icu4x_DecomposingNormalizer_D_HPP 2 #define icu4x_DecomposingNormalizer_D_HPP 3 4 #include <stdio.h> 5 #include <stdint.h> 6 #include <stddef.h> 7 #include <stdbool.h> 8 #include <memory> 9 #include <functional> 10 #include <optional> 11 #include <cstdlib> 12 #include "../diplomat_runtime.hpp" 13 14 namespace icu4x { 15 namespace capi { struct DataProvider; } 16 class DataProvider; 17 namespace capi { struct DecomposingNormalizer; } 18 class DecomposingNormalizer; 19 class DataError; 20 } 21 22 23 namespace icu4x { 24 namespace capi { 25 struct DecomposingNormalizer; 26 } // namespace capi 27 } // namespace 28 29 namespace icu4x { 30 /** 31 * See the [Rust documentation for `DecomposingNormalizer`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html) for more information. 32 */ 33 class DecomposingNormalizer { 34 public: 35 36 /** 37 * Construct a new DecomposingNormalizer instance for NFD using compiled data. 38 * 39 * See the [Rust documentation for `new_nfd`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.new_nfd) for more information. 40 */ 41 inline static std::unique_ptr<icu4x::DecomposingNormalizer> create_nfd(); 42 43 /** 44 * Construct a new DecomposingNormalizer instance for NFD using a particular data source. 45 * 46 * See the [Rust documentation for `new_nfd`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.new_nfd) for more information. 47 */ 48 inline static diplomat::result<std::unique_ptr<icu4x::DecomposingNormalizer>, icu4x::DataError> create_nfd_with_provider(const icu4x::DataProvider& provider); 49 50 /** 51 * Construct a new DecomposingNormalizer instance for NFKD using compiled data. 52 * 53 * See the [Rust documentation for `new_nfkd`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.new_nfkd) for more information. 54 */ 55 inline static std::unique_ptr<icu4x::DecomposingNormalizer> create_nfkd(); 56 57 /** 58 * Construct a new DecomposingNormalizer instance for NFKD using a particular data source. 59 * 60 * See the [Rust documentation for `new_nfkd`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizer.html#method.new_nfkd) for more information. 61 */ 62 inline static diplomat::result<std::unique_ptr<icu4x::DecomposingNormalizer>, icu4x::DataError> create_nfkd_with_provider(const icu4x::DataProvider& provider); 63 64 /** 65 * Normalize a string 66 * 67 * Ill-formed input is treated as if errors had been replaced with REPLACEMENT CHARACTERs according 68 * to the WHATWG Encoding Standard. 69 * 70 * See the [Rust documentation for `normalize_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizerBorrowed.html#method.normalize_utf8) for more information. 71 */ 72 inline std::string normalize(std::string_view s) const; 73 74 /** 75 * Check if a string is normalized 76 * 77 * Ill-formed input is treated as if errors had been replaced with REPLACEMENT CHARACTERs according 78 * to the WHATWG Encoding Standard. 79 * 80 * See the [Rust documentation for `is_normalized_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizerBorrowed.html#method.is_normalized_utf8) for more information. 81 */ 82 inline bool is_normalized(std::string_view s) const; 83 84 /** 85 * Check if a string is normalized 86 * 87 * Ill-formed input is treated as if errors had been replaced with REPLACEMENT CHARACTERs according 88 * to the WHATWG Encoding Standard. 89 * 90 * See the [Rust documentation for `is_normalized_utf16`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizerBorrowed.html#method.is_normalized_utf16) for more information. 91 */ 92 inline bool is_normalized_utf16(std::u16string_view s) const; 93 94 /** 95 * Return the index a slice of potentially-invalid UTF-8 is normalized up to 96 * 97 * See the [Rust documentation for `split_normalized_utf8`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizerBorrowed.html#method.split_normalized_utf8) for more information. 98 * 99 * See the [Rust documentation for `split_normalized`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizerBorrowed.html#method.split_normalized) for more information. 100 */ 101 inline size_t is_normalized_up_to(std::string_view s) const; 102 103 /** 104 * Return the index a slice of potentially-invalid UTF-16 is normalized up to 105 * 106 * See the [Rust documentation for `split_normalized_utf16`](https://docs.rs/icu/latest/icu/normalizer/struct.DecomposingNormalizerBorrowed.html#method.split_normalized_utf16) for more information. 107 */ 108 inline size_t is_normalized_utf16_up_to(std::u16string_view s) const; 109 110 inline const icu4x::capi::DecomposingNormalizer* AsFFI() const; 111 inline icu4x::capi::DecomposingNormalizer* AsFFI(); 112 inline static const icu4x::DecomposingNormalizer* FromFFI(const icu4x::capi::DecomposingNormalizer* ptr); 113 inline static icu4x::DecomposingNormalizer* FromFFI(icu4x::capi::DecomposingNormalizer* ptr); 114 inline static void operator delete(void* ptr); 115 private: 116 DecomposingNormalizer() = delete; 117 DecomposingNormalizer(const icu4x::DecomposingNormalizer&) = delete; 118 DecomposingNormalizer(icu4x::DecomposingNormalizer&&) noexcept = delete; 119 DecomposingNormalizer operator=(const icu4x::DecomposingNormalizer&) = delete; 120 DecomposingNormalizer operator=(icu4x::DecomposingNormalizer&&) noexcept = delete; 121 static void operator delete[](void*, size_t) = delete; 122 }; 123 124 } // namespace 125 #endif // icu4x_DecomposingNormalizer_D_HPP