TitlecaseMapper.d.hpp (3456B)
1 #ifndef icu4x_TitlecaseMapper_D_HPP 2 #define icu4x_TitlecaseMapper_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 TitlecaseMapper; } 20 class TitlecaseMapper; 21 struct TitlecaseOptionsV1; 22 class DataError; 23 } 24 25 26 namespace icu4x { 27 namespace capi { 28 struct TitlecaseMapper; 29 } // namespace capi 30 } // namespace 31 32 namespace icu4x { 33 /** 34 * See the [Rust documentation for `TitlecaseMapper`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html) for more information. 35 */ 36 class TitlecaseMapper { 37 public: 38 39 /** 40 * Construct a new `TitlecaseMapper` instance using compiled data. 41 * 42 * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html#method.new) for more information. 43 */ 44 inline static diplomat::result<std::unique_ptr<icu4x::TitlecaseMapper>, icu4x::DataError> create(); 45 46 /** 47 * Construct a new `TitlecaseMapper` instance using a particular data source. 48 * 49 * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapper.html#method.new) for more information. 50 */ 51 inline static diplomat::result<std::unique_ptr<icu4x::TitlecaseMapper>, icu4x::DataError> create_with_provider(const icu4x::DataProvider& provider); 52 53 /** 54 * Returns the full titlecase mapping of the given string 55 * 56 * The `v1` refers to the version of the options struct, which may change as we add more options 57 * 58 * See the [Rust documentation for `titlecase_segment`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapperBorrowed.html#method.titlecase_segment) for more information. 59 */ 60 inline diplomat::result<std::string, diplomat::Utf8Error> titlecase_segment_v1(std::string_view s, const icu4x::Locale& locale, icu4x::TitlecaseOptionsV1 options) const; 61 62 /** 63 * Returns the full titlecase mapping of the given string, using compiled data (avoids having to allocate a TitlecaseMapper object) 64 * 65 * The `v1` refers to the version of the options struct, which may change as we add more options 66 * 67 * See the [Rust documentation for `titlecase_segment`](https://docs.rs/icu/latest/icu/casemap/struct.TitlecaseMapperBorrowed.html#method.titlecase_segment) for more information. 68 */ 69 inline static diplomat::result<std::string, diplomat::Utf8Error> titlecase_segment_with_compiled_data_v1(std::string_view s, const icu4x::Locale& locale, icu4x::TitlecaseOptionsV1 options); 70 71 inline const icu4x::capi::TitlecaseMapper* AsFFI() const; 72 inline icu4x::capi::TitlecaseMapper* AsFFI(); 73 inline static const icu4x::TitlecaseMapper* FromFFI(const icu4x::capi::TitlecaseMapper* ptr); 74 inline static icu4x::TitlecaseMapper* FromFFI(icu4x::capi::TitlecaseMapper* ptr); 75 inline static void operator delete(void* ptr); 76 private: 77 TitlecaseMapper() = delete; 78 TitlecaseMapper(const icu4x::TitlecaseMapper&) = delete; 79 TitlecaseMapper(icu4x::TitlecaseMapper&&) noexcept = delete; 80 TitlecaseMapper operator=(const icu4x::TitlecaseMapper&) = delete; 81 TitlecaseMapper operator=(icu4x::TitlecaseMapper&&) noexcept = delete; 82 static void operator delete[](void*, size_t) = delete; 83 }; 84 85 } // namespace 86 #endif // icu4x_TitlecaseMapper_D_HPP