tor-browser

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

CaseMapper.d.hpp (8426B)


      1 #ifndef icu4x_CaseMapper_D_HPP
      2 #define icu4x_CaseMapper_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 CaseMapper; }
     16 class CaseMapper;
     17 namespace capi { struct CodePointSetBuilder; }
     18 class CodePointSetBuilder;
     19 namespace capi { struct DataProvider; }
     20 class DataProvider;
     21 namespace capi { struct Locale; }
     22 class Locale;
     23 struct TitlecaseOptionsV1;
     24 class DataError;
     25 }
     26 
     27 
     28 namespace icu4x {
     29 namespace capi {
     30    struct CaseMapper;
     31 } // namespace capi
     32 } // namespace
     33 
     34 namespace icu4x {
     35 /**
     36 * See the [Rust documentation for `CaseMapper`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html) for more information.
     37 */
     38 class CaseMapper {
     39 public:
     40 
     41  /**
     42   * Construct a new CaseMapper instance using compiled data.
     43   *
     44   * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.new) for more information.
     45   */
     46  inline static std::unique_ptr<icu4x::CaseMapper> create();
     47 
     48  /**
     49   * Construct a new CaseMapper instance using a particular data source.
     50   *
     51   * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapper.html#method.new) for more information.
     52   */
     53  inline static diplomat::result<std::unique_ptr<icu4x::CaseMapper>, icu4x::DataError> create_with_provider(const icu4x::DataProvider& provider);
     54 
     55  /**
     56   * Returns the full lowercase mapping of the given string
     57   *
     58   * See the [Rust documentation for `lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.lowercase) for more information.
     59   */
     60  inline diplomat::result<std::string, diplomat::Utf8Error> lowercase(std::string_view s, const icu4x::Locale& locale) const;
     61 
     62  /**
     63   * Returns the full uppercase mapping of the given string
     64   *
     65   * See the [Rust documentation for `uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.uppercase) for more information.
     66   */
     67  inline diplomat::result<std::string, diplomat::Utf8Error> uppercase(std::string_view s, const icu4x::Locale& locale) const;
     68 
     69  /**
     70   * Returns the full lowercase mapping of the given string, using compiled data (avoids having to allocate a CaseMapper object)
     71   *
     72   * See the [Rust documentation for `lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.lowercase) for more information.
     73   */
     74  inline static diplomat::result<std::string, diplomat::Utf8Error> lowercase_with_compiled_data(std::string_view s, const icu4x::Locale& locale);
     75 
     76  /**
     77   * Returns the full uppercase mapping of the given string, using compiled data (avoids having to allocate a CaseMapper object)
     78   *
     79   * See the [Rust documentation for `uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.uppercase) for more information.
     80   */
     81  inline static diplomat::result<std::string, diplomat::Utf8Error> uppercase_with_compiled_data(std::string_view s, const icu4x::Locale& locale);
     82 
     83  /**
     84   * Returns the full titlecase mapping of the given string, performing head adjustment without
     85   * loading additional data.
     86   * (if head adjustment is enabled in the options)
     87   *
     88   * The `v1` refers to the version of the options struct, which may change as we add more options
     89   *
     90   * See the [Rust documentation for `titlecase_segment_with_only_case_data`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.titlecase_segment_with_only_case_data) for more information.
     91   */
     92  inline diplomat::result<std::string, diplomat::Utf8Error> titlecase_segment_with_only_case_data_v1(std::string_view s, const icu4x::Locale& locale, icu4x::TitlecaseOptionsV1 options) const;
     93 
     94  /**
     95   * Case-folds the characters in the given string
     96   *
     97   * See the [Rust documentation for `fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.fold) for more information.
     98   */
     99  inline diplomat::result<std::string, diplomat::Utf8Error> fold(std::string_view s) const;
    100 
    101  /**
    102   * Case-folds the characters in the given string
    103   * using Turkic (T) mappings for dotted/dotless I.
    104   *
    105   * See the [Rust documentation for `fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.fold_turkic) for more information.
    106   */
    107  inline diplomat::result<std::string, diplomat::Utf8Error> fold_turkic(std::string_view s) const;
    108 
    109  /**
    110   * Adds all simple case mappings and the full case folding for `c` to `builder`.
    111   * Also adds special case closure mappings.
    112   *
    113   * In other words, this adds all characters that this casemaps to, as
    114   * well as all characters that may casemap to this one.
    115   *
    116   * Note that since CodePointSetBuilder does not contain strings, this will
    117   * ignore string mappings.
    118   *
    119   * Identical to the similarly named method on `CaseMapCloser`, use that if you
    120   * plan on using string case closure mappings too.
    121   *
    122   * See the [Rust documentation for `add_case_closure_to`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.add_case_closure_to) for more information.
    123   */
    124  inline void add_case_closure_to(char32_t c, icu4x::CodePointSetBuilder& builder) const;
    125 
    126  /**
    127   * Returns the simple lowercase mapping of the given character.
    128   *
    129   * This function only implements simple and common mappings.
    130   * Full mappings, which can map one char to a string, are not included.
    131   * For full mappings, use `CaseMapperBorrowed::lowercase`.
    132   *
    133   * See the [Rust documentation for `simple_lowercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.simple_lowercase) for more information.
    134   */
    135  inline char32_t simple_lowercase(char32_t ch) const;
    136 
    137  /**
    138   * Returns the simple uppercase mapping of the given character.
    139   *
    140   * This function only implements simple and common mappings.
    141   * Full mappings, which can map one char to a string, are not included.
    142   * For full mappings, use `CaseMapperBorrowed::uppercase`.
    143   *
    144   * See the [Rust documentation for `simple_uppercase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.simple_uppercase) for more information.
    145   */
    146  inline char32_t simple_uppercase(char32_t ch) const;
    147 
    148  /**
    149   * Returns the simple titlecase mapping of the given character.
    150   *
    151   * This function only implements simple and common mappings.
    152   * Full mappings, which can map one char to a string, are not included.
    153   * For full mappings, use `CaseMapperBorrowed::titlecase_segment`.
    154   *
    155   * See the [Rust documentation for `simple_titlecase`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.simple_titlecase) for more information.
    156   */
    157  inline char32_t simple_titlecase(char32_t ch) const;
    158 
    159  /**
    160   * Returns the simple casefolding of the given character.
    161   *
    162   * This function only implements simple folding.
    163   * For full folding, use `CaseMapperBorrowed::fold`.
    164   *
    165   * See the [Rust documentation for `simple_fold`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.simple_fold) for more information.
    166   */
    167  inline char32_t simple_fold(char32_t ch) const;
    168 
    169  /**
    170   * Returns the simple casefolding of the given character in the Turkic locale
    171   *
    172   * This function only implements simple folding.
    173   * For full folding, use `CaseMapperBorrowed::fold_turkic`.
    174   *
    175   * See the [Rust documentation for `simple_fold_turkic`](https://docs.rs/icu/latest/icu/casemap/struct.CaseMapperBorrowed.html#method.simple_fold_turkic) for more information.
    176   */
    177  inline char32_t simple_fold_turkic(char32_t ch) const;
    178 
    179  inline const icu4x::capi::CaseMapper* AsFFI() const;
    180  inline icu4x::capi::CaseMapper* AsFFI();
    181  inline static const icu4x::CaseMapper* FromFFI(const icu4x::capi::CaseMapper* ptr);
    182  inline static icu4x::CaseMapper* FromFFI(icu4x::capi::CaseMapper* ptr);
    183  inline static void operator delete(void* ptr);
    184 private:
    185  CaseMapper() = delete;
    186  CaseMapper(const icu4x::CaseMapper&) = delete;
    187  CaseMapper(icu4x::CaseMapper&&) noexcept = delete;
    188  CaseMapper operator=(const icu4x::CaseMapper&) = delete;
    189  CaseMapper operator=(icu4x::CaseMapper&&) noexcept = delete;
    190  static void operator delete[](void*, size_t) = delete;
    191 };
    192 
    193 } // namespace
    194 #endif // icu4x_CaseMapper_D_HPP