WeekInformation.d.hpp (3500B)
1 #ifndef icu4x_WeekInformation_D_HPP 2 #define icu4x_WeekInformation_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 Locale; } 18 class Locale; 19 namespace capi { struct WeekInformation; } 20 class WeekInformation; 21 namespace capi { struct WeekdaySetIterator; } 22 class WeekdaySetIterator; 23 class DataError; 24 class Weekday; 25 } 26 27 28 namespace icu4x { 29 namespace capi { 30 struct WeekInformation; 31 } // namespace capi 32 } // namespace 33 34 namespace icu4x { 35 /** 36 * A Week calculator, useful to be passed in to `week_of_year()` on Date and DateTime types 37 * 38 * See the [Rust documentation for `WeekInformation`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekInformation.html) for more information. 39 */ 40 class WeekInformation { 41 public: 42 43 /** 44 * Creates a new [`WeekInformation`] from locale data using compiled data. 45 * 46 * See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekInformation.html#method.try_new) for more information. 47 */ 48 inline static diplomat::result<std::unique_ptr<icu4x::WeekInformation>, icu4x::DataError> create(const icu4x::Locale& locale); 49 50 /** 51 * Creates a new [`WeekInformation`] from locale data using a particular data source. 52 * 53 * See the [Rust documentation for `try_new`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekInformation.html#method.try_new) for more information. 54 */ 55 inline static diplomat::result<std::unique_ptr<icu4x::WeekInformation>, icu4x::DataError> create_with_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale); 56 57 /** 58 * Returns the weekday that starts the week for this object's locale 59 * 60 * See the [Rust documentation for `first_weekday`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekInformation.html#structfield.first_weekday) for more information. 61 */ 62 inline icu4x::Weekday first_weekday() const; 63 64 /** 65 * See the [Rust documentation for `weekend`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekInformation.html#structfield.weekend) for more information. 66 * 67 * See the [Rust documentation for `contains`](https://docs.rs/icu/latest/icu/calendar/provider/struct.WeekdaySet.html#method.contains) for more information. 68 */ 69 inline bool is_weekend(icu4x::Weekday day) const; 70 71 /** 72 * See the [Rust documentation for `weekend`](https://docs.rs/icu/latest/icu/calendar/week/struct.WeekInformation.html#method.weekend) for more information. 73 */ 74 inline std::unique_ptr<icu4x::WeekdaySetIterator> weekend() const; 75 76 inline const icu4x::capi::WeekInformation* AsFFI() const; 77 inline icu4x::capi::WeekInformation* AsFFI(); 78 inline static const icu4x::WeekInformation* FromFFI(const icu4x::capi::WeekInformation* ptr); 79 inline static icu4x::WeekInformation* FromFFI(icu4x::capi::WeekInformation* ptr); 80 inline static void operator delete(void* ptr); 81 private: 82 WeekInformation() = delete; 83 WeekInformation(const icu4x::WeekInformation&) = delete; 84 WeekInformation(icu4x::WeekInformation&&) noexcept = delete; 85 WeekInformation operator=(const icu4x::WeekInformation&) = delete; 86 WeekInformation operator=(icu4x::WeekInformation&&) noexcept = delete; 87 static void operator delete[](void*, size_t) = delete; 88 }; 89 90 } // namespace 91 #endif // icu4x_WeekInformation_D_HPP