class ICU4XDataProvider; class ICU4XLocale; #include"ICU4XDateLength.hpp" class ICU4XDateFormatter; #include"ICU4XError.hpp" class ICU4XDate; class ICU4XIsoDate; class ICU4XDateTime; class ICU4XIsoDateTime;
/** * A destruction policy for using ICU4XDateFormatter with std::unique_ptr.
*/ struct ICU4XDateFormatterDeleter { voidoperator()(capi::ICU4XDateFormatter* l) const noexcept {
capi::ICU4XDateFormatter_destroy(l);
}
};
/** * An ICU4X DateFormatter object capable of formatting a [`ICU4XDate`] as a string, * using some calendar specified at runtime in the locale. * * See the [Rust documentation for `DateFormatter`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html) for more information.
*/ class ICU4XDateFormatter { public:
/** * Creates a new [`ICU4XDateFormatter`] from locale data. * * See the [Rust documentation for `try_new_with_length`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.try_new_with_length) for more information.
*/ static diplomat::result<ICU4XDateFormatter, ICU4XError> create_with_length(const ICU4XDataProvider& provider, const ICU4XLocale& locale, ICU4XDateLength date_length);
/** * Formats a [`ICU4XDate`] to a string. * * See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information.
*/ template<typename W> diplomat::result<std::monostate, ICU4XError> format_date_to_writeable(const ICU4XDate& value, W& write) const;
/** * Formats a [`ICU4XIsoDate`] to a string. * * Will convert to this formatter's calendar first * * See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information.
*/ template<typename W> diplomat::result<std::monostate, ICU4XError> format_iso_date_to_writeable(const ICU4XIsoDate& value, W& write) const;
/** * Formats a [`ICU4XIsoDate`] to a string. * * Will convert to this formatter's calendar first * * See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information.
*/
diplomat::result<std::string, ICU4XError> format_iso_date(const ICU4XIsoDate& value) const;
/** * Formats a [`ICU4XDateTime`] to a string. * * See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information.
*/ template<typename W> diplomat::result<std::monostate, ICU4XError> format_datetime_to_writeable(const ICU4XDateTime& value, W& write) const;
/** * Formats a [`ICU4XIsoDateTime`] to a string. * * Will convert to this formatter's calendar first * * See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information.
*/ template<typename W> diplomat::result<std::monostate, ICU4XError> format_iso_datetime_to_writeable(const ICU4XIsoDateTime& value, W& write) const;
/** * Formats a [`ICU4XIsoDateTime`] to a string. * * Will convert to this formatter's calendar first * * See the [Rust documentation for `format`](https://docs.rs/icu/latest/icu/datetime/struct.DateFormatter.html#method.format) for more information.
*/
diplomat::result<std::string, ICU4XError> format_iso_datetime(const ICU4XIsoDateTime& value) const; inlineconst capi::ICU4XDateFormatter* AsFFI() const { return this->inner.get(); } inline capi::ICU4XDateFormatter* AsFFIMut() { return this->inner.get(); } inlineexplicit ICU4XDateFormatter(capi::ICU4XDateFormatter* i) : inner(i) {}
ICU4XDateFormatter() = default;
ICU4XDateFormatter(ICU4XDateFormatter&&) noexcept = default;
ICU4XDateFormatter& operator=(ICU4XDateFormatter&& other) noexcept = default; private:
std::unique_ptr<capi::ICU4XDateFormatter, ICU4XDateFormatterDeleter> inner;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.