tor-browser

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

DataProvider.d.hpp (4063B)


      1 #ifndef icu4x_DataProvider_D_HPP
      2 #define icu4x_DataProvider_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 LocaleFallbacker; }
     18 class LocaleFallbacker;
     19 class DataError;
     20 }
     21 
     22 
     23 namespace icu4x {
     24 namespace capi {
     25    struct DataProvider;
     26 } // namespace capi
     27 } // namespace
     28 
     29 namespace icu4x {
     30 /**
     31 * An ICU4X data provider, capable of loading ICU4X data keys from some source.
     32 *
     33 * Currently the only source supported is loading from "blob" formatted data from a bytes buffer or the file system.
     34 *
     35 * If you wish to use ICU4X's builtin "compiled data", use the version of the constructors that do not have `_with_provider`
     36 * in their names.
     37 *
     38 * See the [Rust documentation for `icu_provider`](https://docs.rs/icu_provider/latest/icu_provider/index.html) for more information.
     39 */
     40 class DataProvider {
     41 public:
     42 
     43  /**
     44   * Constructs an `FsDataProvider` and returns it as an [`DataProvider`].
     45   * Requires the `provider_fs` Cargo feature.
     46   * Not supported in WASM.
     47   *
     48   * See the [Rust documentation for `FsDataProvider`](https://docs.rs/icu_provider_fs/latest/icu_provider_fs/struct.FsDataProvider.html) for more information.
     49   */
     50  inline static diplomat::result<std::unique_ptr<icu4x::DataProvider>, icu4x::DataError> from_fs(std::string_view path);
     51 
     52  /**
     53   * Constructs a `BlobDataProvider` and returns it as an [`DataProvider`].
     54   *
     55   * See the [Rust documentation for `BlobDataProvider`](https://docs.rs/icu_provider_blob/latest/icu_provider_blob/struct.BlobDataProvider.html) for more information.
     56   */
     57  inline static diplomat::result<std::unique_ptr<icu4x::DataProvider>, icu4x::DataError> from_byte_slice(diplomat::span<const uint8_t> blob);
     58 
     59  /**
     60   * Creates a provider that tries the current provider and then, if the current provider
     61   * doesn't support the data key, another provider `other`.
     62   *
     63   * This takes ownership of the `other` provider, leaving an empty provider in its place.
     64   *
     65   * See the [Rust documentation for `ForkByMarkerProvider`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/type.ForkByMarkerProvider.html) for more information.
     66   */
     67  inline diplomat::result<std::monostate, icu4x::DataError> fork_by_marker(icu4x::DataProvider& other);
     68 
     69  /**
     70   * Same as `fork_by_key` but forks by locale instead of key.
     71   *
     72   * See the [Rust documentation for `IdentifierNotFoundPredicate`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fork/predicates/struct.IdentifierNotFoundPredicate.html) for more information.
     73   */
     74  inline diplomat::result<std::monostate, icu4x::DataError> fork_by_locale(icu4x::DataProvider& other);
     75 
     76  /**
     77   * See the [Rust documentation for `new`](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html#method.new) for more information.
     78   *
     79   * Additional information: [1](https://docs.rs/icu_provider_adapters/latest/icu_provider_adapters/fallback/struct.LocaleFallbackProvider.html)
     80   */
     81  inline diplomat::result<std::monostate, icu4x::DataError> enable_locale_fallback_with(const icu4x::LocaleFallbacker& fallbacker);
     82 
     83  inline const icu4x::capi::DataProvider* AsFFI() const;
     84  inline icu4x::capi::DataProvider* AsFFI();
     85  inline static const icu4x::DataProvider* FromFFI(const icu4x::capi::DataProvider* ptr);
     86  inline static icu4x::DataProvider* FromFFI(icu4x::capi::DataProvider* ptr);
     87  inline static void operator delete(void* ptr);
     88 private:
     89  DataProvider() = delete;
     90  DataProvider(const icu4x::DataProvider&) = delete;
     91  DataProvider(icu4x::DataProvider&&) noexcept = delete;
     92  DataProvider operator=(const icu4x::DataProvider&) = delete;
     93  DataProvider operator=(icu4x::DataProvider&&) noexcept = delete;
     94  static void operator delete[](void*, size_t) = delete;
     95 };
     96 
     97 } // namespace
     98 #endif // icu4x_DataProvider_D_HPP