GraphemeClusterSegmenter.d.hpp (4143B)
1 #ifndef icu4x_GraphemeClusterSegmenter_D_HPP 2 #define icu4x_GraphemeClusterSegmenter_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 GraphemeClusterBreakIteratorLatin1; } 18 class GraphemeClusterBreakIteratorLatin1; 19 namespace capi { struct GraphemeClusterBreakIteratorUtf16; } 20 class GraphemeClusterBreakIteratorUtf16; 21 namespace capi { struct GraphemeClusterBreakIteratorUtf8; } 22 class GraphemeClusterBreakIteratorUtf8; 23 namespace capi { struct GraphemeClusterSegmenter; } 24 class GraphemeClusterSegmenter; 25 class DataError; 26 } 27 28 29 namespace icu4x { 30 namespace capi { 31 struct GraphemeClusterSegmenter; 32 } // namespace capi 33 } // namespace 34 35 namespace icu4x { 36 /** 37 * An ICU4X grapheme-cluster-break segmenter, capable of finding grapheme cluster breakpoints 38 * in strings. 39 * 40 * See the [Rust documentation for `GraphemeClusterSegmenter`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html) for more information. 41 */ 42 class GraphemeClusterSegmenter { 43 public: 44 45 /** 46 * Construct an [`GraphemeClusterSegmenter`] using compiled data. 47 * 48 * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.new) for more information. 49 */ 50 inline static std::unique_ptr<icu4x::GraphemeClusterSegmenter> create(); 51 52 /** 53 * Construct an [`GraphemeClusterSegmenter`]. 54 * 55 * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenter.html#method.new) for more information. 56 */ 57 inline static diplomat::result<std::unique_ptr<icu4x::GraphemeClusterSegmenter>, icu4x::DataError> create_with_provider(const icu4x::DataProvider& provider); 58 59 /** 60 * Segments a string. 61 * 62 * Ill-formed input is treated as if errors had been replaced with REPLACEMENT CHARACTERs according 63 * to the WHATWG Encoding Standard. 64 * 65 * See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenterBorrowed.html#method.segment_utf8) for more information. 66 */ 67 inline std::unique_ptr<icu4x::GraphemeClusterBreakIteratorUtf8> segment(std::string_view input) const; 68 69 /** 70 * Segments a string. 71 * 72 * Ill-formed input is treated as if errors had been replaced with REPLACEMENT CHARACTERs according 73 * to the WHATWG Encoding Standard. 74 * 75 * See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenterBorrowed.html#method.segment_utf16) for more information. 76 */ 77 inline std::unique_ptr<icu4x::GraphemeClusterBreakIteratorUtf16> segment16(std::u16string_view input) const; 78 79 /** 80 * Segments a Latin-1 string. 81 * 82 * See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/latest/icu/segmenter/struct.GraphemeClusterSegmenterBorrowed.html#method.segment_latin1) for more information. 83 */ 84 inline std::unique_ptr<icu4x::GraphemeClusterBreakIteratorLatin1> segment_latin1(diplomat::span<const uint8_t> input) const; 85 86 inline const icu4x::capi::GraphemeClusterSegmenter* AsFFI() const; 87 inline icu4x::capi::GraphemeClusterSegmenter* AsFFI(); 88 inline static const icu4x::GraphemeClusterSegmenter* FromFFI(const icu4x::capi::GraphemeClusterSegmenter* ptr); 89 inline static icu4x::GraphemeClusterSegmenter* FromFFI(icu4x::capi::GraphemeClusterSegmenter* ptr); 90 inline static void operator delete(void* ptr); 91 private: 92 GraphemeClusterSegmenter() = delete; 93 GraphemeClusterSegmenter(const icu4x::GraphemeClusterSegmenter&) = delete; 94 GraphemeClusterSegmenter(icu4x::GraphemeClusterSegmenter&&) noexcept = delete; 95 GraphemeClusterSegmenter operator=(const icu4x::GraphemeClusterSegmenter&) = delete; 96 GraphemeClusterSegmenter operator=(icu4x::GraphemeClusterSegmenter&&) noexcept = delete; 97 static void operator delete[](void*, size_t) = delete; 98 }; 99 100 } // namespace 101 #endif // icu4x_GraphemeClusterSegmenter_D_HPP