From 09af946a8f47fe39ac8741db57727856419872aa Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 13 Apr 2026 10:59:19 +0200 Subject: [PATCH] Added more documentation for chrono classes Updated callouts --- docs/IO/bip_buffer_spsc_atomic.md | 2 +- docs/IO/buffer_descriptors.md | 2 +- docs/IO/debounce.md | 2 +- docs/IO/io_port.md | 2 +- docs/callbacks/delegate.md | 2 +- docs/callbacks/delegate_observable.md | 2 +- docs/callbacks/function.md | 2 +- docs/callbacks/inplace_function.md | 2 +- docs/chrono/_index.md | 6 + docs/chrono/chrono-literals.md | 10 +- docs/chrono/day.md | 2 +- docs/chrono/duration/_index.md | 16 + docs/chrono/{ => duration}/duration.md | 20 +- docs/chrono/duration/duration_cast.md | 21 ++ docs/chrono/duration/duration_values.md | 38 +++ docs/chrono/hh_mm_ss.md | 138 +++++++++ docs/chrono/last_spec.md | 25 ++ docs/chrono/month/_index.md | 18 ++ .../Operators.txt => chrono/operators.md} | 151 ++++++++-- .../time_point.txt => chrono/time_point.md} | 187 +++++++++--- docs/chrono/weekday/_index.md | 16 + docs/chrono/year/_index.md | 17 ++ .../chrono/year.txt => chrono/year/year.md} | 252 ++++++++++++---- .../year/year_month.md} | 191 ++++++++---- docs/chrono/year/year_month_day.md | 277 ++++++++++++++++++ docs/codecs/base64.md | 2 +- docs/containers/arrays/array.md | 2 +- docs/containers/arrays/array_view.md | 2 +- docs/containers/arrays/array_wrapper.md | 2 +- docs/containers/bitset.md | 2 +- docs/containers/bloom_filter.md | 2 +- docs/containers/indirect_vector.md | 2 +- docs/containers/maps/const_map.md | 2 +- docs/containers/maps/const_multimap.md | 2 +- docs/containers/vector.md | 2 +- docs/page-template.md | 2 +- docs/ranges/ranges.md | 2 +- docs/raw/chrono/hh_mm_ss.txt | 87 ------ docs/raw/chrono/last_spec.txt | 17 -- 39 files changed, 1201 insertions(+), 328 deletions(-) create mode 100644 docs/chrono/duration/_index.md rename docs/chrono/{ => duration}/duration.md (98%) create mode 100644 docs/chrono/duration/duration_cast.md create mode 100644 docs/chrono/duration/duration_values.md create mode 100644 docs/chrono/hh_mm_ss.md create mode 100644 docs/chrono/last_spec.md create mode 100644 docs/chrono/month/_index.md rename docs/{raw/chrono/Operators.txt => chrono/operators.md} (84%) rename docs/{raw/chrono/time_point.txt => chrono/time_point.md} (64%) create mode 100644 docs/chrono/weekday/_index.md create mode 100644 docs/chrono/year/_index.md rename docs/{raw/chrono/year.txt => chrono/year/year.md} (54%) rename docs/{raw/chrono/year_month.txt => chrono/year/year_month.md} (52%) create mode 100644 docs/chrono/year/year_month_day.md delete mode 100644 docs/raw/chrono/hh_mm_ss.txt delete mode 100644 docs/raw/chrono/last_spec.txt diff --git a/docs/IO/bip_buffer_spsc_atomic.md b/docs/IO/bip_buffer_spsc_atomic.md index 39c0bd9d..14b4cbfb 100644 --- a/docs/IO/bip_buffer_spsc_atomic.md +++ b/docs/IO/bip_buffer_spsc_atomic.md @@ -4,7 +4,7 @@ title: "bip_buffer_spsc_atomic" {{< callout >}} Header: `bip_buffer_spsc_atomic.h` - Supported: tbc + Since: tbc {{< /callout >}} A fixed capacity bipartite buffer. diff --git a/docs/IO/buffer_descriptors.md b/docs/IO/buffer_descriptors.md index 4690f06f..4e49278e 100644 --- a/docs/IO/buffer_descriptors.md +++ b/docs/IO/buffer_descriptors.md @@ -4,7 +4,7 @@ title: "buffer_descriptors" {{< callout >}} Header: `buffer_descriptors.h` - Supported: All versions + Since: All versions {{< /callout >}} A set of descriptors to a collection of buffers. diff --git a/docs/IO/debounce.md b/docs/IO/debounce.md index 249e9e79..502c1878 100644 --- a/docs/IO/debounce.md +++ b/docs/IO/debounce.md @@ -4,7 +4,7 @@ title: "debounce" {{< callout type="info">}} Header: `debounce.h` - Supported: `TBC` + Since: `TBC` {{< /callout >}} A class to debounce signals. diff --git a/docs/IO/io_port.md b/docs/IO/io_port.md index 0675aad9..ca36f401 100644 --- a/docs/IO/io_port.md +++ b/docs/IO/io_port.md @@ -4,7 +4,7 @@ title: "io_port" {{< callout type="info">}} Header: `io_port.h` - Supported: `20.39.0` + Since: `20.39.0` {{< /callout >}} A set of templates for building interface classes to memory mapped hardware ports. diff --git a/docs/callbacks/delegate.md b/docs/callbacks/delegate.md index 99aa4bbf..f3dd7bc6 100644 --- a/docs/callbacks/delegate.md +++ b/docs/callbacks/delegate.md @@ -4,7 +4,7 @@ title: "delegate" {{< callout type="info">}} Header: `delegate.h` - Supported: `TBC` + Since: `TBC` Similar to: [std::function_ref](https://en.cppreference.com/w/cpp/utility/functional/function_ref.html) {{< /callout >}} diff --git a/docs/callbacks/delegate_observable.md b/docs/callbacks/delegate_observable.md index d611c1e1..2b9249a4 100644 --- a/docs/callbacks/delegate_observable.md +++ b/docs/callbacks/delegate_observable.md @@ -4,7 +4,7 @@ title: "delegate_observable" {{< callout type="info">}} Header: `delegate_observable.h` - Supported: `TBC` + Since: `TBC` {{< /callout >}} `etl::delegate_observable` is a variation on the observer pattern idea, but using delegates as the callback mechanism. diff --git a/docs/callbacks/function.md b/docs/callbacks/function.md index e9b37849..7785b0f1 100644 --- a/docs/callbacks/function.md +++ b/docs/callbacks/function.md @@ -8,7 +8,7 @@ title: "function" {{< callout type="info">}} Header: `function.h` - Supported: `TBC` + Since: `TBC` {{< /callout >}} A set of wrapper templates to allow a member or static function to be called without the caller having to know the specific details of the callee apart from the parameter type. The templates allow the called function to be abstracted. diff --git a/docs/callbacks/inplace_function.md b/docs/callbacks/inplace_function.md index 537e4e13..e68c09d5 100644 --- a/docs/callbacks/inplace_function.md +++ b/docs/callbacks/inplace_function.md @@ -5,7 +5,7 @@ weight: 1 {{< callout type="info">}} Header: `inplace_function.h` - Supported: `20.45.0` + Since: `20.45.0` Similar to: [std::function](https://en.cppreference.com/w/cpp/utility/functional/function.html) {{< /callout >}} diff --git a/docs/chrono/_index.md b/docs/chrono/_index.md index 81f589d2..7b4d7c22 100644 --- a/docs/chrono/_index.md +++ b/docs/chrono/_index.md @@ -2,3 +2,9 @@ title: "Chrono" weight: 100 --- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono](https://en.cppreference.com/w/cpp/chrono.html) +{{< /callout >}} \ No newline at end of file diff --git a/docs/chrono/chrono-literals.md b/docs/chrono/chrono-literals.md index 727ca5d6..3c6e701d 100644 --- a/docs/chrono/chrono-literals.md +++ b/docs/chrono/chrono-literals.md @@ -2,7 +2,13 @@ title: "Chrono literals" --- -The ETL Chrono literals are define slightly differently from the STL in that they are user defined, as opposed to language defined. +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::literals::chrono_literals](https://en.cppreference.com/w/cpp/chrono.html#Literals) +{{< /callout >}} + +The ETL Chrono literals are define slightly differently from the STL in that they are *user* defined, as opposed to *language* defined. **Example** For STL, the literal to define year `2025` would be `2025y`. @@ -23,7 +29,7 @@ If enabled, the example of `2025_y` would be written as `2025_year`. | `etl::chrono::microseconds` | `500_us` | `500_microseconds` | | `etl::chrono::nanoseconds` | `500_ns` | `500_nanoseconds` | -Chrono literals may by accessed by using one of the following:- +Chrono literals may by accessed by using one of the following namespaces. ```cpp using namespace etl::chrono; diff --git a/docs/chrono/day.md b/docs/chrono/day.md index 9160a669..9fe3f611 100644 --- a/docs/chrono/day.md +++ b/docs/chrono/day.md @@ -4,7 +4,7 @@ title: "day" {{< callout type="info">}} Header: `chrono.h` - Supported: `TBC` + Since: `TBC` Similar to: [std::chrono::day](https://en.cppreference.com/w/cpp/chrono/day.html) {{< /callout >}} diff --git a/docs/chrono/duration/_index.md b/docs/chrono/duration/_index.md new file mode 100644 index 00000000..31ca2e75 --- /dev/null +++ b/docs/chrono/duration/_index.md @@ -0,0 +1,16 @@ +--- +title: "Duration" +weight: 100 +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono](https://en.cppreference.com/w/cpp/chrono.html) +{{< /callout >}} + +Classes that represent a duration. + +`etl::chrono::duration` +`etl::chrono::duration_cast` +`etl::chrono::duration_values` diff --git a/docs/chrono/duration.md b/docs/chrono/duration/duration.md similarity index 98% rename from docs/chrono/duration.md rename to docs/chrono/duration/duration.md index 2555a372..f760a8a9 100644 --- a/docs/chrono/duration.md +++ b/docs/chrono/duration/duration.md @@ -4,7 +4,7 @@ title: "duration" {{< callout type="info">}} Header: `chrono.h` - Supported: `TBC` + Since: `TBC` Similar to: [std::chrono::duration](https://en.cppreference.com/w/cpp/chrono/duration.html) Similar to: [std::chrono::duration_values](https://en.cppreference.com/w/cpp/chrono/duration_values.html) {{< /callout >}} @@ -48,7 +48,7 @@ using rep = TRep using period = typename TPeriod::type; ``` -## Construction +### Construction ```cpp ETL_CONSTEXPR duration() @@ -85,7 +85,7 @@ ETL_NOEXCEPT Construct from another duration type. Enabled if `etl::ratio_divide::den == 1` -## Tests +### Tests ```cpp ETL_NODISCARD ETL_CONSTEXPR14 @@ -98,7 +98,7 @@ if `time_point < other`, returns `-1` else if `time_point > other`, returns `1` else returns `0` -## Assignment +### Assignment ```cpp ETL_CONSTEXPR14 etl::chrono::duration operator =(const etl::chrono::duration& other) ETL_NOEXCEPT @@ -112,7 +112,7 @@ ETL_CONSTEXPR14 etl::chrono::duration operator =(const etl::chrono::duration& other) ETL_NOEXCEPT ``` -## Convertion +### Convertion ```cpp ETL_CONSTEXPR14 TRep count() const @@ -154,7 +154,7 @@ The absolute value of the duration. --- -## Constants +### Constants ```cpp ETL_NODISCARD static ETL_CONSTEXPR14 etl::chrono::duration zero() @@ -221,7 +221,7 @@ ETL_NOEXCEPT **Description** Post-decrements the duration count. -## Mathematical operators +### Mathematical operators ```cpp ETL_CONSTEXPR14 duration& operator +=(const duration& d) @@ -279,7 +279,7 @@ ETL_NOEXCEPT **Description** Sets this duration to the modulus of duration `d`. -## Comparison +### Comparison ```cpp template ETL_CONSTEXPR14 @@ -292,7 +292,7 @@ If `duration < other`, returns `-1` else if `duration > other`, returns `1` else returns `0` -## Non-member mathematical operators +### Non-member mathematical operators ```cpp template ETL_CONSTEXPR14 @@ -400,7 +400,7 @@ ETL_NOEXCEPT **Description** Operator `%` -## Non-member comparison operators +### Non-member comparison operators ```cpp template ETL_CONSTEXPR14 diff --git a/docs/chrono/duration/duration_cast.md b/docs/chrono/duration/duration_cast.md new file mode 100644 index 00000000..dde0a380 --- /dev/null +++ b/docs/chrono/duration/duration_cast.md @@ -0,0 +1,21 @@ +--- +title: "duration_cast" +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::duration_cast](https://en.cppreference.com/w/cpp/chrono/duration/duration_cast.html) +{{< /callout >}} + +Templates representing a time interval. + +## duration_cast +```cpp +template +ETL_CONSTEXPR14 +TToDuration duration_cast(const etl::chrono::duration& d) +ETL_NOEXCEPT +``` +**Description** +Converts from one duration type to another. diff --git a/docs/chrono/duration/duration_values.md b/docs/chrono/duration/duration_values.md new file mode 100644 index 00000000..274d73e7 --- /dev/null +++ b/docs/chrono/duration/duration_values.md @@ -0,0 +1,38 @@ +--- +title: "duration_values" +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::duration_values](https://en.cppreference.com/w/cpp/chrono/duration_values.html) +{{< /callout >}} + +Templates representing a time interval. + +## duration_values +```cpp +template +struct duration_values +``` +```cpp +ETL_NODISCARD static ETL_CONSTEXPR TRep zero() ETL_NOEXCEPT +``` +**Return** +`TRep(0)` + +--- + +```cpp +ETL_NODISCARD static ETL_CONSTEXPR14 TRep min() ETL_NOEXCEPT +``` +**Return** +`etl::numeric_limits::min()` + +--- + +```cpp +ETL_NODISCARD static ETL_CONSTEXPR14 TRep max() ETL_NOEXCEPT +``` +**Returns** +`etl::numeric_limits::max()` diff --git a/docs/chrono/hh_mm_ss.md b/docs/chrono/hh_mm_ss.md new file mode 100644 index 00000000..7c5eafc9 --- /dev/null +++ b/docs/chrono/hh_mm_ss.md @@ -0,0 +1,138 @@ +--- +title: "hh_mm_ss" +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::hh_mm_ss](https://en.cppreference.com/w/cpp/chrono/hh_mm_ss.html) +{{< /callout >}} + +A type to hold hours, minutes, and seconds. + +```cpp +template +class hh_mm_ss +``` +**Description** +Static asserts if `TDuration` is not a specialisation of `etl::chrono::duration`. + + +## Constants +```cpp +static constexpr int fractional_width; +``` +**Description** +The number of fractional digits. + +## Member types +```cpp +precision +``` +**Description** +The return type for `to_duration`. + +## Constructors +```cpp +ETL_CONSTEXPR +hh_mm_ss() +ETL_NOEXCEPT +``` +**Description** +Default constructor. + +--- + +```cpp +ETL_CONSTEXPR14 +explicit hh_mm_ss(TDuration d) +ETL_NOEXCEPT +``` +**Description** +Construct from `duration`. + +## Access +```pp +ETL_NODISCARD +ETL_CONSTEXPR14 +bool is_negative() const +ETL_NOEXCEPT +``` +**Description** +Checks for negative duration. + +--- + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::hours hours() const +ETL_NOEXCEPT +``` +**Return** +The hours. + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::minutes minutes() const +ETL_NOEXCEPT +``` +**Return** +The minutes. + +--- + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::seconds seconds() const +ETL_NOEXCEPT +``` +**Return** +The seconds. + +--- + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +precision subseconds() const +ETL_NOEXCEPT +``` +**Return** +The subseconds. + +--- + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +explicit operator precision() const +ETL_NOEXCEPT +``` +**Return** +The duration. + +--- + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +precision to_duration() const +ETL_NOEXCEPT +``` +**Return*** +The duration. + +## absolute +```cpp +template +ETL_NODISCARD +ETL_CONSTEXPR14 +TDuration absolute(TDuration dur) +ETL_NOEXCEPT +``` +A specialisation of absolute for `etl::chrono::duration`. +**Return** +The absolute duration value. \ No newline at end of file diff --git a/docs/chrono/last_spec.md b/docs/chrono/last_spec.md new file mode 100644 index 00000000..e8c38680 --- /dev/null +++ b/docs/chrono/last_spec.md @@ -0,0 +1,25 @@ +--- +title: "last_spec" +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::last_spec](https://en.cppreference.com/w/cpp/chrono/last_spec.html) +{{< /callout >}} + +`last_spec` is a tag type that is used in conjunction with other calendar types to indicate the last thing in a sequence. + +```cpp +struct last_spec +{ + explicit last_spec() = default; +}; + +inline constexpr last_spec last{}; +``` + +**Example** + +`2025_y/March/last` for last day of March 2025 i.e. 2025-03-31 + diff --git a/docs/chrono/month/_index.md b/docs/chrono/month/_index.md new file mode 100644 index 00000000..ad033d9a --- /dev/null +++ b/docs/chrono/month/_index.md @@ -0,0 +1,18 @@ +--- +title: "Month" +weight: 100 +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono](https://en.cppreference.com/w/cpp/chrono.html) +{{< /callout >}} + +Classes that represent months. + +`etl::chrono::month` +`etl::chrono::month_day` +`etl::chrono::month_day_last` +`etl::chrono::month_weekday` +`etl::chrono::month_weekday_last` diff --git a/docs/raw/chrono/Operators.txt b/docs/chrono/operators.md similarity index 84% rename from docs/raw/chrono/Operators.txt rename to docs/chrono/operators.md index d14f4fca..eefd5166 100644 --- a/docs/raw/chrono/Operators.txt +++ b/docs/chrono/operators.md @@ -1,224 +1,329 @@ -Operators +--- +title: "operators" +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::operator /](https://en.cppreference.com/w/cpp/chrono/operator_slash.html) +{{< /callout >}} + Operators for building dates. -Back to chrono -____________________________________________________________________________________________________ -month_day + +## month_day Create from month and day. +```cpp ETL_CONSTEXPR14 etl::chrono::month_day operator /(const etl::chrono::month& m, const etl::chrono::day& d) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_day operator /(const etl::chrono::month& m, int d) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_day operator /(int m, const etl::chrono::day& d) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_day operator /(const etl::chrono::day& d, const etl::chrono::month& m) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_day operator /(const etl::chrono::day& d, int m) ETL_NOEXCEPT -____________________________________________________________________________________________________ -month_day_last +``` +## month_day_last + +Create from month and last_spec. + +```cpp ETL_CONSTEXPR14 etl::chrono::month_day_last operator /(const etl::chrono::month& m, etl::chrono::last_spec) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_day_last operator /(int m, etl::chrono::last_spec) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_day_last operator /(etl::chrono::last_spec, const etl::chrono::month& m) ETL_NOEXCEPT - +``` + +```cpp ETL_CONSTEXPR14 etl::chrono::month_day_last operator /(etl::chrono::last_spec, int m) ETL_NOEXCEPT -____________________________________________________________________________________________________ -month_weekday +``` +## month_weekday + +Create from month and weekday. + +```cpp ETL_CONSTEXPR14 etl::chrono::month_weekday operator /(const etl::chrono::month& m, const etl::chrono::weekday_indexed& wdi) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_weekday operator /(int m, const etl::chrono::weekday_indexed& wdi) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_weekday operator /(const etl::chrono::weekday_indexed& wdi, const etl::chrono::month& m) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_weekday operator /(const etl::chrono::weekday_indexed& wdi, int m) ETL_NOEXCEPT -____________________________________________________________________________________________________ -month_weekday_last +``` +## month_weekday_last + +Create from month and weekday_last. + +```cpp ETL_CONSTEXPR14 etl::chrono::month_weekday_last operator /(const etl::chrono::month& m, const etl::chrono::weekday_last& wdl) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_weekday_last operator /(int m, const etl::chrono::weekday_last& wdl) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_weekday_last operator /(const etl::chrono::weekday_last& wdl, const etl::chrono::month& m) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::month_weekday_last operator /(const etl::chrono::weekday_last& wdl, int m) ETL_NOEXCEPT +``` -____________________________________________________________________________________________________ -year_month +## year_month +Create from year and month. + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month operator /(const etl::chrono::year& y, const etl::chrono::month& m) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month operator /(const etl::chrono::year& y, int m) ETL_NOEXCEPT -____________________________________________________________________________________________________ -year_month_day +``` +## year_month_day + +Create from year, month, and day. + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(const etl::chrono::year_month& ym, const etl::chrono::day& d) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(const etl::chrono::year_month& ym, int d ) ETL_NOEXCEPT -____________________________________________________________________________________________________ -year_month_day +``` +## year_month_day + +Create from year and month_day. + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(const etl::chrono::year& y, const etl::chrono::month_day& md) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(int y, const etl::chrono::month_day& md) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(const etl::chrono::month_day& md, const etl::chrono::year& y) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(const etl::chrono::month_day& md, int y) ETL_NOEXCEPT -____________________________________________________________________________________________________ -year_month_day_last +``` +## year_month_day_last + +Create from year_month and last_spec. + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day_last operator /(const etl::chrono::year_month& ym, etl::chrono::last_spec) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day_last operator /(const etl::chrono::year& y, const etl::chrono::month_day_last& mdl) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day_last operator /(int y, const etl::chrono::month_day_last& mdl) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day_last operator /(const etl::chrono::month_day_last& mdl, const etl::chrono::year& y) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_day_last operator /(const etl::chrono::month_day_last& mdl, int y) ETL_NOEXCEPT -____________________________________________________________________________________________________ -year_month_weekday +``` +## year_month_weekday + +Create from year_month and weekday. + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday operator /(const etl::chrono::year_month& ym, const etl::chrono::weekday_indexed& wdi) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday operator /(const etl::chrono::year& y, const etl::chrono::month_weekday& mwd) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday operator /(int y, const etl::chrono::month_weekday& mwd) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday operator /(const etl::chrono::month_weekday& mwd, const etl::chrono::year& y) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday operator /(const etl::chrono::month_weekday& mwd, int y) ETL_NOEXCEPT -____________________________________________________________________________________________________ -year_month_weekday_last +``` +## year_month_weekday_last + +Create from year_month and weekday_last. + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday_last operator /(const etl::chrono::year_month& ym, const etl::chrono::weekday_last& wdl) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday_last operator /(const etl::chrono::year& y, const etl::chrono::month_weekday_last& mwdl) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday_last operator /(int y, const etl::chrono::month_weekday_last& mwdl) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday_last operator /(const etl::chrono::month_weekday_last& mwdl, const etl::chrono::year& y) ETL_NOEXCEPT +``` +```cpp ETL_CONSTEXPR14 etl::chrono::year_month_weekday_last operator /(const etl::chrono::month_weekday_last& mwdl, int y) ETL_NOEXCEPT +``` diff --git a/docs/raw/chrono/time_point.txt b/docs/chrono/time_point.md similarity index 64% rename from docs/raw/chrono/time_point.txt rename to docs/chrono/time_point.md index 30cd9baa..b83e4b3b 100644 --- a/docs/raw/chrono/time_point.txt +++ b/docs/chrono/time_point.md @@ -1,182 +1,273 @@ -time_point -etl::chrono::time_point represents a point in time. -Back to chrono -____________________________________________________________________________________________________ -tme_point +--- +title: "time_point" +--- -Represents a point in time storing a TDuration indicating the time -interval from the start of the TClock's epoch. +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::time_point](https://en.cppreference.com/w/cpp/chrono/time_point.html) +{{< /callout >}} +```cpp template -class time_point -____________________________________________________________________________________________________ -Member types +class time_point; +``` +Represents a point in time storing a `TDuration` indicating the time +interval from the start of the `TClock`'s epoch. +## Member types + +```cpp using clock = TClock using duration = TDuration using rep = typename TDuration::rep using period = typename TDuration::period -____________________________________________________________________________________________________ -Constructors +``` +## Constructors + +```cpp ETL_CONSTEXPR time_point() ETL_NOEXCEPT +``` +**Description** Default constructor. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 explicit time_point(const duration& dur_) ETL_NOEXCEPT +``` +**Description** Construct from a duration. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 time_point(const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Copy constructor. -______________________________________________ + +--- + +```cpp template ETL_CONSTEXPR14 explicit time_point(const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Copy construct from another time_point with a different duration type. -____________________________________________________________________________________________________ -Assignment +## Assignment +```cpp ETL_CONSTEXPR14 time_point& operator =(const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Assignment operator. -____________________________________________________________________________________________________ -Access +## Access +```cpp ETL_NODISCARD ETL_CONSTEXPR14 duration time_since_epoch() const ETL_NOEXCEPT -Returns a duration representing the amount of time between this and the clock's epoch. -____________________________________________________________________________________________________ -Member arithmetic operators +``` +**Return** +A duration representing the amount of time between this and the clock's epoch. +## Member arithmetic operators +```cpp ETL_CONSTEXPR14 time_point& operator +=(const duration& rhs) ETL_NOEXCEPT +``` +**Description** Adds a duration. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 time_point& operator -=(const duration& rhs) ETL_NOEXCEPT +``` +**Description** Subtracts a duration. -____________________________________________________________________________________________________ -Constants +## Constants +```cpp ETL_NODISCARD static ETL_CONSTEXPR14 time_point min() ETL_NOEXCEPT -Returns a time_point with the smallest possible duration. -______________________________________________ +``` +**Return** +A time_point with the smallest possible duration. + +--- + +```cpp ETL_NODISCARD static ETL_CONSTEXPR14 time_point max() ETL_NOEXCEPT -Returns a time_point with the largest possible duration. -____________________________________________________________________________________________________ -Rounding +``` +**Return** +A time_point with the largest possible duration. +## Rounding +```cpp template ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::time_point floor(const etl::chrono::time_point& tp) ETL_NOEXCEPT +``` +**Description** Rounds down a duration to the nearest lower precision. -______________________________________________ + +--- + +```cpp template ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::time_point ceil(const etl::chrono::time_point& tp) ETL_NOEXCEPT +``` +**Description** Rounds up a duration to the nearest higher precision. -______________________________________________ + +--- + +```cp template ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::time_point round(const etl::chrono::time_point& tp) ETL_NOEXCEPT +``` +**Description** Rounds a duration to the nearest precision. If the duration is exactly halfway, it rounds away from zero. -____________________________________________________________________________________________________ -Casting +## Casting +```cpp template ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::time_point time_point_cast(const etl::chrono::time_point& tp) ETL_NOEXCEPT -____________________________________________________________________________________________________ -Comparison +``` +## Comparison +```cpp ETL_NODISCARD ETL_CONSTEXPR14 int compare(const time_point& other) const ETL_NOEXCEPT +``` +**Description** Compare day with another. If time_point < other, returns -1 else if time_point > other, returns 1 else returns 0 -____________________________________________________________________________________________________ -Non-member comparison operators +## Non-member comparison operators +```cpp template ETL_CONSTEXPR14 bool operator ==(const time_point& lhs, const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Equality operator -______________________________________________ + +--- + +```cpp template ETL_CONSTEXPR14 bool operator !=(const time_point& lhs, const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Inequality operator -______________________________________________ + +--- + +```cpp template ETL_CONSTEXPR14 bool operator <(const time_point& lhs, const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Less-than operator -______________________________________________ + +--- + +```cpp template ETL_CONSTEXPR14 bool operator <=(const time_point& lhs, const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Less-than-equal operator -______________________________________________ + +--- + +```cpp template ETL_CONSTEXPR14 bool operator >(const time_point& lhs, const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Greater-than operator -______________________________________________ + +--- + +```cpp template ETL_CONSTEXPR14 bool operator >=(const time_point& lhs, const time_point& rhs) ETL_NOEXCEPT +``` +**Description** Greater-than-equal operator -______________________________________________ + +--- + +```cpp template [[nodiscard]] constexpr auto operator <=>(const etl::chrono::time_point& lhs, const etl::chrono::time_point& rhs) noexcept +``` +**Description** Spaceship operator C++20 -____________________________________________________________________________________________________ -etl::common_type specialisation +## etl::common_type specialisation +```cpp template struct common_type, etl::chrono::time_point> -Defines type, which is the common type of two etl::chrono::time_point - +``` +**Description** +Defines type, which is the common type of two `etl::chrono::time_point`. diff --git a/docs/chrono/weekday/_index.md b/docs/chrono/weekday/_index.md new file mode 100644 index 00000000..7a6b5b39 --- /dev/null +++ b/docs/chrono/weekday/_index.md @@ -0,0 +1,16 @@ +--- +title: "Weekday" +weight: 100 +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono](https://en.cppreference.com/w/cpp/chrono.html) +{{< /callout >}} + +Classes that represent weekdays. + +`etl::chrono::weekday` +`etl::chrono::weekday_indexed` +`etl::chrono::weekday_last` diff --git a/docs/chrono/year/_index.md b/docs/chrono/year/_index.md new file mode 100644 index 00000000..d92383c8 --- /dev/null +++ b/docs/chrono/year/_index.md @@ -0,0 +1,17 @@ +--- +title: "Year" +weight: 100 +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono](https://en.cppreference.com/w/cpp/chrono.html) +{{< /callout >}} + +Classes that represent years. + +`etl::chrono::year` +`etl::chrono::year_month` +`etl::chrono::year_month_day` +`etl::chrono::year_month_day_last` diff --git a/docs/raw/chrono/year.txt b/docs/chrono/year/year.md similarity index 54% rename from docs/raw/chrono/year.txt rename to docs/chrono/year/year.md index 9fcea0a2..ba98b8ad 100644 --- a/docs/raw/chrono/year.txt +++ b/docs/chrono/year/year.md @@ -1,206 +1,328 @@ -year +--- +title: "year" +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::year](https://en.cppreference.com/w/cpp/chrono/year.html) +{{< /callout >}} + A template representing a year. -Back to chrono -____________________________________________________________________________________________________ -year - -STL equivalent: std::chrono::year +```cpp class year -____________________________________________________________________________________________________ -Typesdefs -rep The internal representation. -____________________________________________________________________________________________________ -Construction +``` +## Member types + +`rep` The internal representation. + +## Construction +```cpp ETL_CONSTEXPR year() ETL_NOEXCEPT +``` +**Description** Default constructor. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR explicit year(unsigned value) ETL_NOEXCEPT +``` +**Description** Construct from unsigned. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 year(const etl::chrono::year& other) ETL_NOEXCEPT +``` +**Description** Copy constructor. -____________________________________________________________________________________________________ -Tests +## Tests +```cpp ETL_NODISCARD ETL_CONSTEXPR14 int compare(const etl::chrono::year& other) const ETL_NOEXCEPT +``` +**Description** Compare day with another. -if year < other, returns -1 -else if year > other, returns 1 -else returns 0 -____________________________________________________________________________________________________ -Assignment +if `year < other`, returns `-1` +else if `year > other`, returns `1` +else returns `0` +## Assignment +```cpp ETL_CONSTEXPR14 etl::chrono::year& operator =(const etl::chrono::year& rhs) ETL_NOEXCEPT +``` +**Description** Assignment operator -____________________________________________________________________________________________________ -Increment/decrement +## Increment / decrement +```cpp ETL_CONSTEXPR14 etl::chrono::year& operator ++() ETL_NOEXCEPT +``` +**Description** Pre-increment operator. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year operator ++(int) ETL_NOEXCEPT +``` +**Description** Post-increment operator. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year& operator --() ETL_NOEXCEPT +``` +**Description** Pre-decrement operator. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year operator --(int) ETL_NOEXCEPT +``` +**Description** Post-decrement operator. -____________________________________________________________________________________________________ -Mathematical operators +## Mathematical operators +```cpp ETL_CONSTEXPR14 etl::chrono::year& operator +=(const etl::chrono::years& ys) ETL_NOEXCEPT +``` +**Description** Plus-equals operator adding etl::chrono::years. -______________________________________________ + +--- +```cpp ETL_CONSTEXPR14 etl::chrono::year& operator -=(const etl::chrono::years& ys) ETL_NOEXCEPT +``` +**Description** Minus-equals operator subtracting etl::chrono::years. -____________________________________________________________________________________________________ -Tests +## Tests +```cpp ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT +``` +**Description** Returns true if the year is within the valid -32767 to 32767 range. -______________________________________________ + +--- +```cpp ETL_NODISCARD ETL_CONSTEXPR14 bool is_leap() const ETL_NOEXCEPT +``` +**Description** Returns true if the year is a leap year. -____________________________________________________________________________________________________ -Constants +## Constants +```cpp ETL_NODISCARD static ETL_CONSTEXPR14 etl::chrono::year min() ETL_NOEXCEPT +``` +**Description** The minimum year value for which ok() will return true. -______________________________________________ + +--- + +```cpp ETL_NODISCARD static ETL_CONSTEXPR14 etl::chrono::year max() ETL_NOEXCEPT +``` +**Description** The maximum year value for which ok() will return true. -____________________________________________________________________________________________________ -Conversion +## Conversion +```cpp ETL_CONSTEXPR14 operator int() const ETL_NOEXCEPT -Conversion operator to unsigned int. -____________________________________________________________________________________________________ -Non-member mathematical operators +``` +**Description** +Conversion operator to `unsigned int`. +## Non-member mathematical operators +```cpp ETL_CONSTEXPR14 etl::chrono::year operator +(const etl::chrono::year& y, const etl::chrono::years& ys) ETL_NOEXCEPT -Add etl::chrono::years to etl::chrono::year. -Returns etl::chrono::year. -______________________________________________ +``` +**Description** +Add `etl::chrono::years` to `etl::chrono::year`. +**Return** +`etl::chrono::year`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year operator +(const etl::chrono::years& ys, const etl::chrono::year& y) ETL_NOEXCEPT -Add etl::chrono::year to etl::chrono::years. -Returns etl::chrono::year. -______________________________________________ +``` +**Description** +Add `etl::chrono::year` to `etl::chrono::years`. +**Return** +`etl::chrono::year`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year operator -(const etl::chrono::year& y, const etl::chrono::years& ys) ETL_NOEXCEPT -Subtract etl::chrono::years from etl::chrono::year. -Returns etl::chrono::year. -______________________________________________ +``` +**Description** +Subtract `etl::chrono::years` from `etl::chrono::year`. +**Return** +`etl::chrono::year`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year operator -(const etl::chrono::years& ys, const etl::chrono::year& y) ETL_NOEXCEPT -Subtract etl::chrono::year from etl::chrono::years. -Returns etl::chrono::years. -______________________________________________ +``` +**Description** +Subtract `etl::chrono::year` from `etl::chrono::years`. +**Return** +`etl::chrono::years`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::years operator -(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT -Subtract etl::chrono::year from etl::chrono::year. -Returns etl::chrono::years. -____________________________________________________________________________________________________ -Non-member comparison operators +``` +**Description** +Subtract `etl::chrono::year` from `etl::chrono::year`. +**Return** +`etl::chrono::years`. +## Non-member comparison operators +```cpp ETL_CONSTEXPR14 bool operator ==(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT +``` +**Description** Equality operator. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 bool operator !=(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT +``` +**Description** Inequality operator. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 bool operator <(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT +``` +**Description** Less-than operator. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 bool operator <=(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT +``` +**Description** Less-than-or-equal operator. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 bool operator >(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT +``` +**Description** Greater-than operator. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 bool operator >=(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT +``` +**Description** Greater-than-or-equal operator. -______________________________________________ + +--- + +```cpp [[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::year& y1, const etl::chrono::year& y2) noexcept -Spaceship operator. +``` +**Description** +Spaceship operator. C++20 -____________________________________________________________________________________________________ -Hash +## Hash +```cpp template struct hash -Hash function for etl::chrono::year +``` +**Description** +Hash function for `etl::chrono::year`. diff --git a/docs/raw/chrono/year_month.txt b/docs/chrono/year/year_month.md similarity index 52% rename from docs/raw/chrono/year_month.txt rename to docs/chrono/year/year_month.md index 1a775519..862cd707 100644 --- a/docs/raw/chrono/year_month.txt +++ b/docs/chrono/year/year_month.md @@ -1,133 +1,214 @@ -year_month +--- +title: "year_month" +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::year_month](https://en.cppreference.com/w/cpp/chrono/year_month.html) +{{< /callout >}} + A template representing a year and month. -Back to chrono -____________________________________________________________________________________________________ -year_month - -STL equivalent: std::chrono::year_month +```cpp class year_month -____________________________________________________________________________________________________ -Construction +``` +## Construction +```cpp ETL_CONSTEXPR year_month() +``` +**Description** Default constructor. -______________________________________________ + +--- + +```cpp ETL_CONSTEXPR14 year_month(const etl::chrono::year& y, const etl::chrono::month& m) ETL_NOEXCEPT +``` +**Description** Construct from month and day. -____________________________________________________________________________________________________ -Access +## Access + +```cpp ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::year year() const ETL_NOEXCEPT -Returns the year. -______________________________________________ +``` +**Return** +The year. + +--- + +```cpp ETL_NODISCARD ETL_CONSTEXPR14 etl::chrono::month month() const ETL_NOEXCEPT -Returns the month. -____________________________________________________________________________________________________ -Tests +``` +**Return** +The month. +## Tests + +```cpp ETL_NODISCARD ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT -Returns true if the year and month is within the valid limits. -______________________________________________ +``` +**Return** +`true` if the year and month is within the valid limits. + +--- + +```cpp ETL_NODISCARD ETL_CONSTEXPR14 int compare(const etl::chrono::year_month& other) const ETL_NOEXCEPT -if (y < other.y) return -1 -if (y > other.y) return 1 -if (m < other.m) return -1 -if (m > other.m) return 1 -else return 0 -____________________________________________________________________________________________________ -Non-member mathematical operators +``` +**Description** +If `y < other.y` return `-1` +If `y > other.y` return `1` +If `m < other.m` return `-1` +If `m > other.m` return `1` +Else return `0` +## Non-member mathematical operators + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month operator +(const etl::chrono::year_month& ym, const etl::chrono::years& dy) -Adds etl::chrono::years. -______________________________________________ +``` +**Description** +Adds `etl::chrono::years`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month operator +(const etl::chrono::years& dy, const etl::chrono::year_month& ym) ETL_NOEXCEPT -Adds etl::chrono::years. -______________________________________________ +``` +**Description** +Adds `etl::chrono::years`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month operator +(const etl::chrono::year_month& ym, const etl::chrono::months& dm) ETL_NOEXCEPT -Adds etl::chrono::months. -______________________________________________ +``` +**Description** +Adds `etl::chrono::months`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month operator +(const etl::chrono::months& dm, const etl::chrono::year_month& ym) ETL_NOEXCEPT -Adds etl::chrono::months. -______________________________________________ +``` +**Description** +Adds `etl::chrono::months`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month operator -(const etl::chrono::year_month& ym, const etl::chrono::years& dy) ETL_NOEXCEPT -Subtracts etl::chrono::years. -______________________________________________ +``` +**Description** +Subtracts `etl::chrono::years`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::year_month operator -(const etl::chrono::year_month& ym, const etl::chrono::months& dm) ETL_NOEXCEPT -Subtracts etl::chrono::months. -______________________________________________ +``` +**Description** +Subtracts `etl::chrono::months`. + +--- + +```cpp ETL_CONSTEXPR14 etl::chrono::months operator -(const etl::chrono::year_month& ym1, const etl::chrono::year_month& ym2) ETL_NOEXCEPT -Subtracts etl::chrono::year_month. -____________________________________________________________________________________________________ -Non-member comparison operators +``` +**Description** +Subtracts `etl::chrono::year_month`. +## Non-member comparison operators + +```cpp ETL_CONSTEXPR14 bool operator ==(const etl::chrono::year_month& lhs, const etl::chrono::year_month& rhs) ETL_NOEXCEPT +``` +**Description** Equality operator. -______________________________________________ -ETL_CONSTEXPR14 + +--- + +```cpp +ETL_CONSTEXPR14 bool operator !=(const etl::chrono::year_month& lhs, const etl::chrono::year_month& rhs) ETL_NOEXCEPT +``` +**Description** Inequality operator. -______________________________________________ + +--- + +```cpp [[nodiscard]] friend constexpr auto operator <=>(const etl::chrono::year_month& lhs, const etl::chrono::year_month& rhs) ETL_NOEXCEPT -Spaceship operator -______________________________________________ +``` +**Description** +Spaceship operator +C++20 + +--- + +``` ETL_CONSTEXPR14 int compare(const year_month& other) const -ETL_NOEXCEPT +ETL_NOEXCEPT +``` +**Description** Compare year_month with another. -if month < other.month, returns -1 -else if month > other.month, returns 1 -else if day < other.day, returns -1 -else if day > other.day, returns 1 -else returns 0; -____________________________________________________________________________________________________ -Hash +if `month < other.month`, returns `-1` +else if `month > other.month`, returns `1` +else if `day < other.day`, returns `-1` +else if `day > other.day`, returns `1` +else returns `0`; + +## Hash template struct hash -Hash function for etl::chrono::year_month - +**Description** +Hash function for `etl::chrono::year_month`. diff --git a/docs/chrono/year/year_month_day.md b/docs/chrono/year/year_month_day.md new file mode 100644 index 00000000..27fabfb2 --- /dev/null +++ b/docs/chrono/year/year_month_day.md @@ -0,0 +1,277 @@ +--- +title: "year_month_day" +--- + +{{< callout type="info">}} + Header: `chrono.h` + Since: `20.41.0` + Similar to: [std::chrono::year_month_day](https://en.cppreference.com/w/cpp/chrono/year_month_day.html) +{{< /callout >}} + +A template representing a year, month, and day. + +```cpp +class year_month_day +``` + +## Construction + +```cpp +ETL_CONSTEXPR year_month_day() +``` +**Description** +Default constructor. + +--- + +```cpp +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::year& y, + const etl::chrono::month& m, + const etl::chrono::day& d) +ETL_NOEXCEPT +``` +**Description** +Construct from `month` and `day`. + +--- + +```cpp +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::year_month_day_last& ymdl) +ETL_NOEXCEPT +``` +**Description** +Construct from `year_month_day_last`. + +--- + +```cpp +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::sys_days& sd) +ETL_NOEXCEPT +``` +**Description** +Construct from `sys_days`. + +--- + +```cpp +ETL_CONSTEXPR14 +year_month_day(const etl::chrono::local_days& ld) +ETL_NOEXCEPT +``` +**Description** +Construct from `local_days`. + +## Access + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::year year() const +ETL_NOEXCEPT +``` +**Return** +The year. + +--- + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +etl::chrono::month month() const +ETL_NOEXCEPT +``` +**Return** +The month. + +--- + +``` +ETL_NODISCARD +ETL_CONSTEXPR14 etl::chrono::day day() const +ETL_NOEXCEPT +``` +**Return** +The day. + +## Tests + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +bool ok() const +ETL_NOEXCEPT +``` +**Return** +`true` if the year and month is within the valid limits. + +--- + +```cpp +ETL_NODISCARD +ETL_CONSTEXPR14 +int compare(const etl::chrono::year_month_day& other) const +ETL_NOEXCEPT +``` +**Description** +Compare `year_month_day` with another. +if `year < other.year`, returns `-1` +else if `year > other.year`, returns `1` +if `month < other.month`, returns `-1` +else if `month > other.month`, returns `1` +else if `day < other.day`, returns `-1` +else if `day > other.day`, returns `1` +else returns `0` + +## operators + +```cpp +ETL_CONSTEXPR14 +etl::chrono::year_month_day& operator +=(const etl::chrono::years& dy) +ETL_NOEXCEPT +``` +**Description** +Adds `etl::chrono::years`. + +--- + +```cpp +ETL_CONSTEXPR14 +etl::chrono::year_month_day& operator +=(const etl::chrono::months& dm) +ETL_NOEXCEPT +``` +**Description** +Adds `etl::chrono::months`. + +--- + +```cpp +ETL_CONSTEXPR14 +etl::chrono::year_month_day& operator -=(const etl::chrono::years& dy) +ETL_NOEXCEPT +``` +**Description** +Subtracts `etl::chrono::years`. + +--- + +``` +ETL_CONSTEXPR14 +etl::chrono::year_month_day& operator -=(const etl::chrono::months& dm) +ETL_NOEXCEPT +``` +**Description** +Subtracts `etl::chrono::months`. + +## Non-member operators + +```cpp +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator +(const etl::chrono::year_month_day& ym, + const etl::chrono::years& dy) +``` +**Description** +Adds `etl::chrono::years`. + +--- + +```cpp +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator +(const etl::chrono::years& dy, + const etl::chrono::year_month_day& ym) +ETL_NOEXCEPT +``` +**Description** +Adds `etl::chrono::years`. + +--- + +```cpp +ETL_CONSTEXPR14 +etl::chrono::year_month_day operator +(const etl::chrono::year_month_day& ym, + const etl::chrono::months& dm) +ETL_NOEXCEPT +``` +**Description** +Adds `etl::chrono::months`. + +--- + +``` +ETL_CONSTEXPR14 +etl::chrono::year_month operator +(const etl::chrono::months& dm, + const etl::chrono::year_month_day& ym) +ETL_NOEXCEPT +``` +**Description** +Adds `etl::chrono::months`. + +--- + +```cpp +ETL_CONSTEXPR14 +etl::chrono::year_month operator -(const etl::chrono::year_month_day& ym, + const etl::chrono::years& dy) +ETL_NOEXCEPT +``` +**Description** +Subtracts `etl::chrono::years`. + +--- + +```cpp +ETL_CONSTEXPR14 +etl::chrono::year_month operator -(const etl::chrono::year_month_day& ym, + const etl::chrono::months& dm) +ETL_NOEXCEPT +``` +**Description** +Subtracts `etl::chrono::months`. + +## Non-member comparison operators + +```cpp +ETL_CONSTEXPR14 +bool operator ==(const etl::chrono::year_month_day& lhs, + const etl::chrono::year_month_day& rhs) +ETL_NOEXCEPT +``` +**Description** +Equality operator. + +--- + +```cpp +ETL_CONSTEXPR14 +bool operator !=(const etl::chrono::year_month_day& lhs, + const etl::chrono::year_month_day& rhs) +ETL_NOEXCEPT +``` +**Description** +Inequality operator. + +--- + +```cpp +[[nodiscard]] friend constexpr +auto operator <=>(const etl::chrono::year_month_day& lhs, + const etl::chrono::year_month_day& rhs) +ETL_NOEXCEPT +``` +**Description** +Spaceship operator +C++20 + +## Hash + +```cpp +template <> +struct hash +``` +**Description** +Hash function for `etl::chrono::year_month_day`. + + + diff --git a/docs/codecs/base64.md b/docs/codecs/base64.md index 0da2d4d1..96102871 100644 --- a/docs/codecs/base64.md +++ b/docs/codecs/base64.md @@ -7,7 +7,7 @@ title: "Base64" `base64.h` Common definitions `base64_encoder.h` Encoder class `base64_decoder.h` Decoder class - Supported: `20.38.4` + Since: `20.38.4` {{< /callout >}} Encodes and decodes data to and from Base64 format. diff --git a/docs/containers/arrays/array.md b/docs/containers/arrays/array.md index 7f0a5805..08f4f697 100644 --- a/docs/containers/arrays/array.md +++ b/docs/containers/arrays/array.md @@ -5,7 +5,7 @@ weight: 1 {{< callout >}} Header: `array.h` - Supported: All versions + Since: All versions Similar to: [std::array](https://en.cppreference.com/w/cpp/container/array.html) {{< /callout >}} diff --git a/docs/containers/arrays/array_view.md b/docs/containers/arrays/array_view.md index 50728bef..094e36cc 100644 --- a/docs/containers/arrays/array_view.md +++ b/docs/containers/arrays/array_view.md @@ -4,7 +4,7 @@ title: "array_view" {{< callout >}} Header: `array_view.h` - Supported: All versions + Since: All versions Similar to: [gsl::array_view](https://learn.microsoft.com/en-us/previous-versions/cpp/parallel/amp/reference/array-view-class) {{< /callout >}} diff --git a/docs/containers/arrays/array_wrapper.md b/docs/containers/arrays/array_wrapper.md index bf27c3dd..c84afe5d 100644 --- a/docs/containers/arrays/array_wrapper.md +++ b/docs/containers/arrays/array_wrapper.md @@ -4,7 +4,7 @@ title: "array_wrapper" {{< callout >}} Header: `array_wrapper.h` - Supported: All versions + Since: All versions {{< /callout >}} This class implements a zero cost C++ interface around a const or non-const C array. It presents the same API as std::array. diff --git a/docs/containers/bitset.md b/docs/containers/bitset.md index d156fa61..f7ff61d8 100644 --- a/docs/containers/bitset.md +++ b/docs/containers/bitset.md @@ -4,7 +4,7 @@ title: "bitset" {{< callout >}} Header: `bitset.h` - Supported: 20.33.0 + Since: 20.33.0 Similar to: [std::bitset](https://en.cppreference.com/w/cpp/utility/bitset.html) {{< /callout >}} diff --git a/docs/containers/bloom_filter.md b/docs/containers/bloom_filter.md index d0c4d3c5..048bbb1d 100644 --- a/docs/containers/bloom_filter.md +++ b/docs/containers/bloom_filter.md @@ -4,7 +4,7 @@ title: "bloom_filter" {{< callout >}} Header: `bloom_filter.h` - Supported: All versions + Since: All versions {{< /callout >}} ```cpp diff --git a/docs/containers/indirect_vector.md b/docs/containers/indirect_vector.md index 960028f6..3a8ab82f 100644 --- a/docs/containers/indirect_vector.md +++ b/docs/containers/indirect_vector.md @@ -4,7 +4,7 @@ title: "indirect_vector" {{< callout >}} Header: `vector.h` - Supported: All versions + Since: All versions Similar to: [std::vectr](https://en.cppreference.com/w/cpp/container/vector.html) {{< /callout >}} diff --git a/docs/containers/maps/const_map.md b/docs/containers/maps/const_map.md index ac5906c3..2679776b 100644 --- a/docs/containers/maps/const_map.md +++ b/docs/containers/maps/const_map.md @@ -4,7 +4,7 @@ title: "const_map / const_map_ext" {{< callout >}} Header: `const_map.h` - Supported: TBC + Since: TBC Similar to: [std::map](https://en.cppreference.com/w/cpp/container/map.html) {{< /callout >}} diff --git a/docs/containers/maps/const_multimap.md b/docs/containers/maps/const_multimap.md index 881b287e..59d4de03 100644 --- a/docs/containers/maps/const_multimap.md +++ b/docs/containers/maps/const_multimap.md @@ -4,7 +4,7 @@ title: "const_multimap / const_multimap_ext" {{< callout >}} Header: `const_multimap.h` - Supported: TBC + Since: TBC Similar to: [std::multimap](https://en.cppreference.com/w/cpp/container/multimap.html) {{< /callout >}} diff --git a/docs/containers/vector.md b/docs/containers/vector.md index ee215e53..e3fe14a9 100644 --- a/docs/containers/vector.md +++ b/docs/containers/vector.md @@ -4,7 +4,7 @@ title: "vector" {{< callout >}} Header: `vector.h` - Supported: All versions + Since: All versions Similar to: [std::vectr](https://en.cppreference.com/w/cpp/container/vector.html) {{< /callout >}} diff --git a/docs/page-template.md b/docs/page-template.md index 7e9e6e86..fc7ccceb 100644 --- a/docs/page-template.md +++ b/docs/page-template.md @@ -6,7 +6,7 @@ weight: 1 {{< callout type="info">}} Header: `my_class.h` - Supported: `xx.yy.zz` + Since: `xx.yy.zz` Similar to: [Some similar in the STL](https://en.cppreference.com/w/cpp/stl_header.html) {{< /callout >}} diff --git a/docs/ranges/ranges.md b/docs/ranges/ranges.md index b5a31daf..48b9b495 100644 --- a/docs/ranges/ranges.md +++ b/docs/ranges/ranges.md @@ -5,7 +5,7 @@ weight: 1 {{< callout >}} Header: `ranges.h` - Supported: 20.46.2 + Since: 20.46.2 Similar to: [std::ranges](https://en.cppreference.com/w/cpp/ranges.html) {{< /callout >}} diff --git a/docs/raw/chrono/hh_mm_ss.txt b/docs/raw/chrono/hh_mm_ss.txt deleted file mode 100644 index f7db1ebc..00000000 --- a/docs/raw/chrono/hh_mm_ss.txt +++ /dev/null @@ -1,87 +0,0 @@ -hh_mm_ss -A type to hold hous, minutes, and seconds. -Back to chrono -____________________________________________________________________________________________________ -absolute - -template -ETL_NODISCARD -ETL_CONSTEXPR14 -TDuration absolute(TDuration dur) -ETL_NOEXCEPT -A specialisation of absolute for etl::chrono::duration. -Returns the absolute duration value. -____________________________________________________________________________________________________ -hh_mm_ss - -template -class hh_mm_ss - -Static asserts if TDuration is not a specialisation of etl::chrono::duration. -____________________________________________________________________________________________________ -Class constant - -static constexpr int fractional_width; -The number of fractional digits. -____________________________________________________________________________________________________ -Class type - -precision -The return type for to_duration. -____________________________________________________________________________________________________ -Constructors - -ETL_CONSTEXPR -hh_mm_ss() -ETL_NOEXCEPT -Default constructor. -______________________________________________ -ETL_CONSTEXPR14 -explicit hh_mm_ss(TDuration d) -ETL_NOEXCEPT -Construct from duration. - ____________________________________________________________________________________________________ -Access - -ETL_NODISCARD -ETL_CONSTEXPR14 -bool is_negative() const -ETL_NOEXCEPT -Checks for negative duration. -______________________________________________ -ETL_NODISCARD -ETL_CONSTEXPR14 -etl::chrono::hours hours() const -ETL_NOEXCEPT -Returns the hours. -______________________________________________ -ETL_NODISCARD -ETL_CONSTEXPR14 -etl::chrono::minutes minutes() const -ETL_NOEXCEPT -Returns the minutes. -______________________________________________ -ETL_NODISCARD -ETL_CONSTEXPR14 -etl::chrono::seconds seconds() const -ETL_NOEXCEPT -Returns the seconds. -______________________________________________ -ETL_NODISCARD -ETL_CONSTEXPR14 -precision subseconds() const -ETL_NOEXCEPT -Returns the subseconds. -______________________________________________ -ETL_NODISCARD -ETL_CONSTEXPR14 -explicit operator precision() const -ETL_NOEXCEPT -Returns the duration. -______________________________________________ -ETL_NODISCARD -ETL_CONSTEXPR14 -precision to_duration() const -ETL_NOEXCEPT -Returns the duration. - diff --git a/docs/raw/chrono/last_spec.txt b/docs/raw/chrono/last_spec.txt deleted file mode 100644 index 9acf616d..00000000 --- a/docs/raw/chrono/last_spec.txt +++ /dev/null @@ -1,17 +0,0 @@ -last_spec -last_spec is a tag type that is used in conjunction with other calendar types to indicate the last thing in a sequence. -Back to chrono -____________________________________________________________________________________________________ -last_spec - -struct last_spec -{ - explicit last_spec() = default; -}; - -inline constexpr last_spec last{}; - -Example: - -2025_y/March/last for last day of March 2025 i.e. 2025-03-31 -