tor-browser

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

DateTimeWriteError.d.hpp (1584B)


      1 #ifndef icu4x_DateTimeWriteError_D_HPP
      2 #define icu4x_DateTimeWriteError_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 
     15 namespace icu4x {
     16 namespace capi {
     17    enum DateTimeWriteError {
     18      DateTimeWriteError_Unknown = 0,
     19      DateTimeWriteError_MissingTimeZoneVariant = 1,
     20    };
     21 
     22    typedef struct DateTimeWriteError_option {union { DateTimeWriteError ok; }; bool is_ok; } DateTimeWriteError_option;
     23 } // namespace capi
     24 } // namespace
     25 
     26 namespace icu4x {
     27 /**
     28 * An error when formatting a datetime.
     29 *
     30 * Currently the only reachable error here is a missing time zone variant. If you encounter
     31 * that error, you need to call `with_variant` or `infer_variant` on your `TimeZoneInfo`.
     32 *
     33 * Additional information: [1](https://docs.rs/icu/latest/icu/datetime/unchecked/enum.FormattedDateTimeUncheckedError.html)
     34 */
     35 class DateTimeWriteError {
     36 public:
     37  enum Value {
     38    Unknown = 0,
     39    MissingTimeZoneVariant = 1,
     40  };
     41 
     42  DateTimeWriteError() = default;
     43  // Implicit conversions between enum and ::Value
     44  constexpr DateTimeWriteError(Value v) : value(v) {}
     45  constexpr operator Value() const { return value; }
     46  // Prevent usage as boolean value
     47  explicit operator bool() const = delete;
     48 
     49  inline icu4x::capi::DateTimeWriteError AsFFI() const;
     50  inline static icu4x::DateTimeWriteError FromFFI(icu4x::capi::DateTimeWriteError c_enum);
     51 private:
     52    Value value;
     53 };
     54 
     55 } // namespace
     56 #endif // icu4x_DateTimeWriteError_D_HPP