tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GeneralCategory.d.hpp (4946B)


      1 #ifndef icu4x_GeneralCategory_D_HPP
      2 #define icu4x_GeneralCategory_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 struct GeneralCategoryGroup;
     16 class GeneralCategory;
     17 }
     18 
     19 
     20 namespace icu4x {
     21 namespace capi {
     22    enum GeneralCategory {
     23      GeneralCategory_Unassigned = 0,
     24      GeneralCategory_UppercaseLetter = 1,
     25      GeneralCategory_LowercaseLetter = 2,
     26      GeneralCategory_TitlecaseLetter = 3,
     27      GeneralCategory_ModifierLetter = 4,
     28      GeneralCategory_OtherLetter = 5,
     29      GeneralCategory_NonspacingMark = 6,
     30      GeneralCategory_SpacingMark = 8,
     31      GeneralCategory_EnclosingMark = 7,
     32      GeneralCategory_DecimalNumber = 9,
     33      GeneralCategory_LetterNumber = 10,
     34      GeneralCategory_OtherNumber = 11,
     35      GeneralCategory_SpaceSeparator = 12,
     36      GeneralCategory_LineSeparator = 13,
     37      GeneralCategory_ParagraphSeparator = 14,
     38      GeneralCategory_Control = 15,
     39      GeneralCategory_Format = 16,
     40      GeneralCategory_PrivateUse = 17,
     41      GeneralCategory_Surrogate = 18,
     42      GeneralCategory_DashPunctuation = 19,
     43      GeneralCategory_OpenPunctuation = 20,
     44      GeneralCategory_ClosePunctuation = 21,
     45      GeneralCategory_ConnectorPunctuation = 22,
     46      GeneralCategory_InitialPunctuation = 28,
     47      GeneralCategory_FinalPunctuation = 29,
     48      GeneralCategory_OtherPunctuation = 23,
     49      GeneralCategory_MathSymbol = 24,
     50      GeneralCategory_CurrencySymbol = 25,
     51      GeneralCategory_ModifierSymbol = 26,
     52      GeneralCategory_OtherSymbol = 27,
     53    };
     54 
     55    typedef struct GeneralCategory_option {union { GeneralCategory ok; }; bool is_ok; } GeneralCategory_option;
     56 } // namespace capi
     57 } // namespace
     58 
     59 namespace icu4x {
     60 /**
     61 * See the [Rust documentation for `GeneralCategory`](https://docs.rs/icu/latest/icu/properties/props/enum.GeneralCategory.html) for more information.
     62 */
     63 class GeneralCategory {
     64 public:
     65  enum Value {
     66    Unassigned = 0,
     67    UppercaseLetter = 1,
     68    LowercaseLetter = 2,
     69    TitlecaseLetter = 3,
     70    ModifierLetter = 4,
     71    OtherLetter = 5,
     72    NonspacingMark = 6,
     73    SpacingMark = 8,
     74    EnclosingMark = 7,
     75    DecimalNumber = 9,
     76    LetterNumber = 10,
     77    OtherNumber = 11,
     78    SpaceSeparator = 12,
     79    LineSeparator = 13,
     80    ParagraphSeparator = 14,
     81    Control = 15,
     82    Format = 16,
     83    PrivateUse = 17,
     84    Surrogate = 18,
     85    DashPunctuation = 19,
     86    OpenPunctuation = 20,
     87    ClosePunctuation = 21,
     88    ConnectorPunctuation = 22,
     89    InitialPunctuation = 28,
     90    FinalPunctuation = 29,
     91    OtherPunctuation = 23,
     92    MathSymbol = 24,
     93    CurrencySymbol = 25,
     94    ModifierSymbol = 26,
     95    OtherSymbol = 27,
     96  };
     97 
     98  GeneralCategory() = default;
     99  // Implicit conversions between enum and ::Value
    100  constexpr GeneralCategory(Value v) : value(v) {}
    101  constexpr operator Value() const { return value; }
    102  // Prevent usage as boolean value
    103  explicit operator bool() const = delete;
    104 
    105  /**
    106   * See the [Rust documentation for `for_char`](https://docs.rs/icu/latest/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information.
    107   */
    108  inline static icu4x::GeneralCategory for_char(char32_t ch);
    109 
    110  /**
    111   * Convert to an integer using the ICU4C integer mappings for `General_Category`
    112   * Get the "long" name of this property value (returns empty if property value is unknown)
    113   *
    114   * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesLongBorrowed.html#method.get) for more information.
    115   */
    116  inline std::optional<std::string_view> long_name() const;
    117 
    118  /**
    119   * Get the "short" name of this property value (returns empty if property value is unknown)
    120   *
    121   * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesShortBorrowed.html#method.get) for more information.
    122   */
    123  inline std::optional<std::string_view> short_name() const;
    124 
    125  /**
    126   * Convert to an integer value usable with ICU4C and CodePointMapData
    127   */
    128  inline uint8_t to_integer_value() const;
    129 
    130  /**
    131   * Produces a GeneralCategoryGroup mask that can represent a group of general categories
    132   *
    133   * See the [Rust documentation for `GeneralCategoryGroup`](https://docs.rs/icu/latest/icu/properties/props/struct.GeneralCategoryGroup.html) for more information.
    134   */
    135  inline icu4x::GeneralCategoryGroup to_group() const;
    136 
    137  /**
    138   * Convert from an integer using the ICU4C integer mappings for `General_Category`
    139   * Convert from an integer value from ICU4C or CodePointMapData
    140   */
    141  inline static std::optional<icu4x::GeneralCategory> from_integer_value(uint8_t other);
    142 
    143  inline icu4x::capi::GeneralCategory AsFFI() const;
    144  inline static icu4x::GeneralCategory FromFFI(icu4x::capi::GeneralCategory c_enum);
    145 private:
    146    Value value;
    147 };
    148 
    149 } // namespace
    150 #endif // icu4x_GeneralCategory_D_HPP