Collator.d.hpp (3593B)
1 #ifndef icu4x_Collator_D_HPP 2 #define icu4x_Collator_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 Collator; } 16 class Collator; 17 namespace capi { struct DataProvider; } 18 class DataProvider; 19 namespace capi { struct Locale; } 20 class Locale; 21 struct CollatorOptionsV1; 22 struct CollatorResolvedOptionsV1; 23 class DataError; 24 } 25 26 27 namespace icu4x { 28 namespace capi { 29 struct Collator; 30 } // namespace capi 31 } // namespace 32 33 namespace icu4x { 34 /** 35 * See the [Rust documentation for `Collator`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html) for more information. 36 */ 37 class Collator { 38 public: 39 40 /** 41 * Construct a new Collator instance using compiled data. 42 * 43 * See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.try_new) for more information. 44 */ 45 inline static diplomat::result<std::unique_ptr<icu4x::Collator>, icu4x::DataError> create_v1(const icu4x::Locale& locale, icu4x::CollatorOptionsV1 options); 46 47 /** 48 * Construct a new Collator instance using a particular data source. 49 * 50 * See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/collator/struct.Collator.html#method.try_new) for more information. 51 */ 52 inline static diplomat::result<std::unique_ptr<icu4x::Collator>, icu4x::DataError> create_v1_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale, icu4x::CollatorOptionsV1 options); 53 54 /** 55 * Compare two strings. 56 * 57 * Ill-formed input is treated as if errors had been replaced with REPLACEMENT CHARACTERs according 58 * to the WHATWG Encoding Standard. 59 * 60 * See the [Rust documentation for `compare_utf8`](https://docs.rs/icu/latest/icu/collator/struct.CollatorBorrowed.html#method.compare_utf8) for more information. 61 */ 62 inline int8_t compare(std::string_view left, std::string_view right) const; 63 64 /** 65 * Compare two strings. 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 `compare_utf16`](https://docs.rs/icu/latest/icu/collator/struct.CollatorBorrowed.html#method.compare_utf16) for more information. 71 */ 72 inline int8_t compare16(std::u16string_view left, std::u16string_view right) const; 73 74 /** 75 * The resolved options showing how the default options, the requested options, 76 * and the options from locale data were combined. None of the struct fields 77 * will have `Auto` as the value. 78 * 79 * See the [Rust documentation for `resolved_options`](https://docs.rs/icu/latest/icu/collator/struct.CollatorBorrowed.html#method.resolved_options) for more information. 80 */ 81 inline icu4x::CollatorResolvedOptionsV1 resolved_options_v1() const; 82 83 inline const icu4x::capi::Collator* AsFFI() const; 84 inline icu4x::capi::Collator* AsFFI(); 85 inline static const icu4x::Collator* FromFFI(const icu4x::capi::Collator* ptr); 86 inline static icu4x::Collator* FromFFI(icu4x::capi::Collator* ptr); 87 inline static void operator delete(void* ptr); 88 private: 89 Collator() = delete; 90 Collator(const icu4x::Collator&) = delete; 91 Collator(icu4x::Collator&&) noexcept = delete; 92 Collator operator=(const icu4x::Collator&) = delete; 93 Collator operator=(icu4x::Collator&&) noexcept = delete; 94 static void operator delete[](void*, size_t) = delete; 95 }; 96 97 } // namespace 98 #endif // icu4x_Collator_D_HPP