BidiInfo.d.hpp (2014B)
1 #ifndef icu4x_BidiInfo_D_HPP 2 #define icu4x_BidiInfo_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 BidiParagraph; } 16 class BidiParagraph; 17 } 18 19 20 namespace icu4x { 21 namespace capi { 22 struct BidiInfo; 23 } // namespace capi 24 } // namespace 25 26 namespace icu4x { 27 /** 28 * An object containing bidi information for a given string, produced by `for_text()` on `Bidi` 29 * 30 * See the [Rust documentation for `BidiInfo`](https://docs.rs/unicode_bidi/latest/unicode_bidi/struct.BidiInfo.html) for more information. 31 */ 32 class BidiInfo { 33 public: 34 35 /** 36 * The number of paragraphs contained here 37 */ 38 inline size_t paragraph_count() const; 39 40 /** 41 * Get the nth paragraph, returning `None` if out of bounds 42 */ 43 inline std::unique_ptr<icu4x::BidiParagraph> paragraph_at(size_t n) const; 44 45 /** 46 * The number of bytes in this full text 47 */ 48 inline size_t size() const; 49 50 /** 51 * Get the BIDI level at a particular byte index in the full text. 52 * This integer is conceptually a `unicode_bidi::Level`, 53 * and can be further inspected using the static methods on Bidi. 54 * 55 * Returns 0 (equivalent to `Level::ltr()`) on error 56 */ 57 inline uint8_t level_at(size_t pos) const; 58 59 inline const icu4x::capi::BidiInfo* AsFFI() const; 60 inline icu4x::capi::BidiInfo* AsFFI(); 61 inline static const icu4x::BidiInfo* FromFFI(const icu4x::capi::BidiInfo* ptr); 62 inline static icu4x::BidiInfo* FromFFI(icu4x::capi::BidiInfo* ptr); 63 inline static void operator delete(void* ptr); 64 private: 65 BidiInfo() = delete; 66 BidiInfo(const icu4x::BidiInfo&) = delete; 67 BidiInfo(icu4x::BidiInfo&&) noexcept = delete; 68 BidiInfo operator=(const icu4x::BidiInfo&) = delete; 69 BidiInfo operator=(icu4x::BidiInfo&&) noexcept = delete; 70 static void operator delete[](void*, size_t) = delete; 71 }; 72 73 } // namespace 74 #endif // icu4x_BidiInfo_D_HPP