PluralRules.d.hpp (3952B)
1 #ifndef icu4x_PluralRules_D_HPP 2 #define icu4x_PluralRules_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 Locale; } 18 class Locale; 19 namespace capi { struct PluralOperands; } 20 class PluralOperands; 21 namespace capi { struct PluralRules; } 22 class PluralRules; 23 struct PluralCategories; 24 class DataError; 25 class PluralCategory; 26 } 27 28 29 namespace icu4x { 30 namespace capi { 31 struct PluralRules; 32 } // namespace capi 33 } // namespace 34 35 namespace icu4x { 36 /** 37 * See the [Rust documentation for `PluralRules`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html) for more information. 38 */ 39 class PluralRules { 40 public: 41 42 /** 43 * Construct an [`PluralRules`] for the given locale, for cardinal numbers, using compiled data. 44 * 45 * See the [Rust documentation for `try_new_cardinal`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.try_new_cardinal) for more information. 46 */ 47 inline static diplomat::result<std::unique_ptr<icu4x::PluralRules>, icu4x::DataError> create_cardinal(const icu4x::Locale& locale); 48 49 /** 50 * Construct an [`PluralRules`] for the given locale, for cardinal numbers, using a particular data source. 51 * 52 * See the [Rust documentation for `try_new_cardinal`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.try_new_cardinal) for more information. 53 */ 54 inline static diplomat::result<std::unique_ptr<icu4x::PluralRules>, icu4x::DataError> create_cardinal_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 55 56 /** 57 * Construct an [`PluralRules`] for the given locale, for ordinal numbers, using compiled data. 58 * 59 * See the [Rust documentation for `try_new_ordinal`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.try_new_ordinal) for more information. 60 */ 61 inline static diplomat::result<std::unique_ptr<icu4x::PluralRules>, icu4x::DataError> create_ordinal(const icu4x::Locale& locale); 62 63 /** 64 * Construct an [`PluralRules`] for the given locale, for ordinal numbers, using a particular data source. 65 * 66 * See the [Rust documentation for `try_new_ordinal`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.try_new_ordinal) for more information. 67 */ 68 inline static diplomat::result<std::unique_ptr<icu4x::PluralRules>, icu4x::DataError> create_ordinal_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 69 70 /** 71 * Get the category for a given number represented as operands 72 * 73 * See the [Rust documentation for `category_for`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.category_for) for more information. 74 */ 75 inline icu4x::PluralCategory category_for(const icu4x::PluralOperands& op) const; 76 77 /** 78 * Get all of the categories needed in the current locale 79 * 80 * See the [Rust documentation for `categories`](https://docs.rs/icu/latest/icu/plurals/struct.PluralRules.html#method.categories) for more information. 81 */ 82 inline icu4x::PluralCategories categories() const; 83 84 inline const icu4x::capi::PluralRules* AsFFI() const; 85 inline icu4x::capi::PluralRules* AsFFI(); 86 inline static const icu4x::PluralRules* FromFFI(const icu4x::capi::PluralRules* ptr); 87 inline static icu4x::PluralRules* FromFFI(icu4x::capi::PluralRules* ptr); 88 inline static void operator delete(void* ptr); 89 private: 90 PluralRules() = delete; 91 PluralRules(const icu4x::PluralRules&) = delete; 92 PluralRules(icu4x::PluralRules&&) noexcept = delete; 93 PluralRules operator=(const icu4x::PluralRules&) = delete; 94 PluralRules operator=(icu4x::PluralRules&&) noexcept = delete; 95 static void operator delete[](void*, size_t) = delete; 96 }; 97 98 } // namespace 99 #endif // icu4x_PluralRules_D_HPP