tor-browser

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

IsoDate.d.hpp (6131B)


      1 #ifndef icu4x_IsoDate_D_HPP
      2 #define icu4x_IsoDate_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 Calendar; }
     16 class Calendar;
     17 namespace capi { struct Date; }
     18 class Date;
     19 namespace capi { struct IsoDate; }
     20 class IsoDate;
     21 struct IsoWeekOfYear;
     22 class CalendarError;
     23 class Rfc9557ParseError;
     24 class Weekday;
     25 }
     26 
     27 
     28 namespace icu4x {
     29 namespace capi {
     30    struct IsoDate;
     31 } // namespace capi
     32 } // namespace
     33 
     34 namespace icu4x {
     35 /**
     36 * An ICU4X Date object capable of containing a ISO-8601 date
     37 *
     38 * See the [Rust documentation for `Date`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html) for more information.
     39 */
     40 class IsoDate {
     41 public:
     42 
     43  /**
     44   * Creates a new [`IsoDate`] from the specified date.
     45   *
     46   * See the [Rust documentation for `try_new_iso`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_new_iso) for more information.
     47   */
     48  inline static diplomat::result<std::unique_ptr<icu4x::IsoDate>, icu4x::CalendarError> create(int32_t year, uint8_t month, uint8_t day);
     49 
     50  /**
     51   * Creates a new [`IsoDate`] from the given Rata Die
     52   *
     53   * See the [Rust documentation for `from_rata_die`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.from_rata_die) for more information.
     54   */
     55  inline static std::unique_ptr<icu4x::IsoDate> from_rata_die(int64_t rd);
     56 
     57  /**
     58   * Creates a new [`IsoDate`] from an IXDTF string.
     59   *
     60   * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.try_from_str) for more information.
     61   */
     62  inline static diplomat::result<std::unique_ptr<icu4x::IsoDate>, icu4x::Rfc9557ParseError> from_string(std::string_view v);
     63 
     64  /**
     65   * Convert this date to one in a different calendar
     66   *
     67   * See the [Rust documentation for `to_calendar`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_calendar) for more information.
     68   */
     69  inline std::unique_ptr<icu4x::Date> to_calendar(const icu4x::Calendar& calendar) const;
     70 
     71  /**
     72   * See the [Rust documentation for `to_any`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_any) for more information.
     73   */
     74  inline std::unique_ptr<icu4x::Date> to_any() const;
     75 
     76  /**
     77   * Returns this date's Rata Die
     78   *
     79   * See the [Rust documentation for `to_rata_die`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.to_rata_die) for more information.
     80   */
     81  inline int64_t to_rata_die() const;
     82 
     83  /**
     84   * Returns the 1-indexed day in the year for this date
     85   *
     86   * See the [Rust documentation for `day_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_year) for more information.
     87   */
     88  inline uint16_t day_of_year() const;
     89 
     90  /**
     91   * Returns the 1-indexed day in the month for this date
     92   *
     93   * See the [Rust documentation for `day_of_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_month) for more information.
     94   */
     95  inline uint8_t day_of_month() const;
     96 
     97  /**
     98   * Returns the day in the week for this day
     99   *
    100   * See the [Rust documentation for `day_of_week`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.day_of_week) for more information.
    101   */
    102  inline icu4x::Weekday day_of_week() const;
    103 
    104  /**
    105   * Returns the week number in this year, using week data
    106   *
    107   * See the [Rust documentation for `week_of_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.week_of_year) for more information.
    108   */
    109  inline icu4x::IsoWeekOfYear week_of_year() const;
    110 
    111  /**
    112   * Returns 1-indexed number of the month of this date in its year
    113   *
    114   * See the [Rust documentation for `ordinal`](https://docs.rs/icu/latest/icu/calendar/types/struct.MonthInfo.html#structfield.ordinal) for more information.
    115   *
    116   * Additional information: [1](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.month)
    117   */
    118  inline uint8_t month() const;
    119 
    120  /**
    121   * Returns the year number in the current era for this date
    122   *
    123   * For calendars without an era, returns the extended year
    124   *
    125   * See the [Rust documentation for `year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.year) for more information.
    126   */
    127  inline int32_t year() const;
    128 
    129  /**
    130   * Returns if the year is a leap year for this date
    131   *
    132   * See the [Rust documentation for `is_in_leap_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.is_in_leap_year) for more information.
    133   */
    134  inline bool is_in_leap_year() const;
    135 
    136  /**
    137   * Returns the number of months in the year represented by this date
    138   *
    139   * See the [Rust documentation for `months_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.months_in_year) for more information.
    140   */
    141  inline uint8_t months_in_year() const;
    142 
    143  /**
    144   * Returns the number of days in the month represented by this date
    145   *
    146   * See the [Rust documentation for `days_in_month`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_month) for more information.
    147   */
    148  inline uint8_t days_in_month() const;
    149 
    150  /**
    151   * Returns the number of days in the year represented by this date
    152   *
    153   * See the [Rust documentation for `days_in_year`](https://docs.rs/icu/latest/icu/calendar/struct.Date.html#method.days_in_year) for more information.
    154   */
    155  inline uint16_t days_in_year() const;
    156 
    157  inline const icu4x::capi::IsoDate* AsFFI() const;
    158  inline icu4x::capi::IsoDate* AsFFI();
    159  inline static const icu4x::IsoDate* FromFFI(const icu4x::capi::IsoDate* ptr);
    160  inline static icu4x::IsoDate* FromFFI(icu4x::capi::IsoDate* ptr);
    161  inline static void operator delete(void* ptr);
    162 private:
    163  IsoDate() = delete;
    164  IsoDate(const icu4x::IsoDate&) = delete;
    165  IsoDate(icu4x::IsoDate&&) noexcept = delete;
    166  IsoDate operator=(const icu4x::IsoDate&) = delete;
    167  IsoDate operator=(icu4x::IsoDate&&) noexcept = delete;
    168  static void operator delete[](void*, size_t) = delete;
    169 };
    170 
    171 } // namespace
    172 #endif // icu4x_IsoDate_D_HPP