1d7862497SMark de Wever // -*- C++ -*- 2d7862497SMark de Wever //===----------------------------------------------------------------------===// 3d7862497SMark de Wever // 4d7862497SMark de Wever // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5d7862497SMark de Wever // See https://llvm.org/LICENSE.txt for license information. 6d7862497SMark de Wever // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7d7862497SMark de Wever // 8d7862497SMark de Wever //===----------------------------------------------------------------------===// 9d7862497SMark de Wever 10d7862497SMark de Wever #ifndef _LIBCPP___CHRONO_MONTH_WEEKDAY_H 11d7862497SMark de Wever #define _LIBCPP___CHRONO_MONTH_WEEKDAY_H 12d7862497SMark de Wever 13d7862497SMark de Wever #include <__chrono/month.h> 14d7862497SMark de Wever #include <__chrono/weekday.h> 15d7862497SMark de Wever #include <__config> 16d7862497SMark de Wever 17d7862497SMark de Wever #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 18d7862497SMark de Wever # pragma GCC system_header 19d7862497SMark de Wever #endif 20d7862497SMark de Wever 214f15267dSNikolas Klauser #if _LIBCPP_STD_VER >= 20 22d7862497SMark de Wever 23d7862497SMark de Wever _LIBCPP_BEGIN_NAMESPACE_STD 24d7862497SMark de Wever 25*9783f28cSLouis Dionne namespace chrono { 26d7862497SMark de Wever 27d7862497SMark de Wever class month_weekday { 28d7862497SMark de Wever private: 2984fc2c3cSNikolas Klauser chrono::month __m_; 3084fc2c3cSNikolas Klauser chrono::weekday_indexed __wdi_; 31*9783f28cSLouis Dionne 32d7862497SMark de Wever public: month_weekday(const chrono::month & __mval,const chrono::weekday_indexed & __wdival)33*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval, 34*9783f28cSLouis Dionne const chrono::weekday_indexed& __wdival) noexcept 3584fc2c3cSNikolas Klauser : __m_{__mval}, __wdi_{__wdival} {} month()3684fc2c3cSNikolas Klauser _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } weekday_indexed()3784fc2c3cSNikolas Klauser _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; } ok()3884fc2c3cSNikolas Klauser _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); } 39d7862497SMark de Wever }; 40d7862497SMark de Wever 41*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr bool 42*9783f28cSLouis Dionne operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept { 43*9783f28cSLouis Dionne return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); 44*9783f28cSLouis Dionne } 45d7862497SMark de Wever 46*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday 47*9783f28cSLouis Dionne operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept { 48*9783f28cSLouis Dionne return month_weekday{__lhs, __rhs}; 49*9783f28cSLouis Dionne } 50d7862497SMark de Wever 51*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept { 52*9783f28cSLouis Dionne return month_weekday{month(__lhs), __rhs}; 53*9783f28cSLouis Dionne } 54d7862497SMark de Wever 55*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday 56*9783f28cSLouis Dionne operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept { 57*9783f28cSLouis Dionne return month_weekday{__rhs, __lhs}; 58*9783f28cSLouis Dionne } 59d7862497SMark de Wever 60*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept { 61*9783f28cSLouis Dionne return month_weekday{month(__rhs), __lhs}; 62*9783f28cSLouis Dionne } 63d7862497SMark de Wever 64d7862497SMark de Wever class month_weekday_last { 6584fc2c3cSNikolas Klauser chrono::month __m_; 6684fc2c3cSNikolas Klauser chrono::weekday_last __wdl_; 67*9783f28cSLouis Dionne 68d7862497SMark de Wever public: month_weekday_last(const chrono::month & __mval,const chrono::weekday_last & __wdlval)69*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval, 70*9783f28cSLouis Dionne const chrono::weekday_last& __wdlval) noexcept 7184fc2c3cSNikolas Klauser : __m_{__mval}, __wdl_{__wdlval} {} month()7284fc2c3cSNikolas Klauser _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; } weekday_last()7384fc2c3cSNikolas Klauser _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; } ok()7484fc2c3cSNikolas Klauser _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); } 75d7862497SMark de Wever }; 76d7862497SMark de Wever 77*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr bool 78*9783f28cSLouis Dionne operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept { 79*9783f28cSLouis Dionne return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); 80*9783f28cSLouis Dionne } 81d7862497SMark de Wever 82*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last 83*9783f28cSLouis Dionne operator/(const month& __lhs, const weekday_last& __rhs) noexcept { 84*9783f28cSLouis Dionne return month_weekday_last{__lhs, __rhs}; 85*9783f28cSLouis Dionne } 86d7862497SMark de Wever 87*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept { 88*9783f28cSLouis Dionne return month_weekday_last{month(__lhs), __rhs}; 89*9783f28cSLouis Dionne } 90d7862497SMark de Wever 91*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last 92*9783f28cSLouis Dionne operator/(const weekday_last& __lhs, const month& __rhs) noexcept { 93*9783f28cSLouis Dionne return month_weekday_last{__rhs, __lhs}; 94*9783f28cSLouis Dionne } 95d7862497SMark de Wever 96*9783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept { 97*9783f28cSLouis Dionne return month_weekday_last{month(__rhs), __lhs}; 98*9783f28cSLouis Dionne } 99d7862497SMark de Wever } // namespace chrono 100d7862497SMark de Wever 101d7862497SMark de Wever _LIBCPP_END_NAMESPACE_STD 102d7862497SMark de Wever 1034f15267dSNikolas Klauser #endif // _LIBCPP_STD_VER >= 20 104d7862497SMark de Wever 105d7862497SMark de Wever #endif // _LIBCPP___CHRONO_MONTH_WEEKDAY_H 106