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