Path: blob/main/contrib/llvm-project/libcxx/include/__chrono/month_weekday.h
35262 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___CHRONO_MONTH_WEEKDAY_H10#define _LIBCPP___CHRONO_MONTH_WEEKDAY_H1112#include <__chrono/month.h>13#include <__chrono/weekday.h>14#include <__config>1516#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)17# pragma GCC system_header18#endif1920#if _LIBCPP_STD_VER >= 202122_LIBCPP_BEGIN_NAMESPACE_STD2324namespace chrono {2526class month_weekday {27private:28chrono::month __m_;29chrono::weekday_indexed __wdi_;3031public:32_LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval,33const chrono::weekday_indexed& __wdival) noexcept34: __m_{__mval}, __wdi_{__wdival} {}35_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }36_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }37_LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }38};3940_LIBCPP_HIDE_FROM_ABI inline constexpr bool41operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept {42return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed();43}4445_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday46operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept {47return month_weekday{__lhs, __rhs};48}4950_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept {51return month_weekday{month(__lhs), __rhs};52}5354_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday55operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept {56return month_weekday{__rhs, __lhs};57}5859_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept {60return month_weekday{month(__rhs), __lhs};61}6263class month_weekday_last {64chrono::month __m_;65chrono::weekday_last __wdl_;6667public:68_LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval,69const chrono::weekday_last& __wdlval) noexcept70: __m_{__mval}, __wdl_{__wdlval} {}71_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }72_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }73_LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }74};7576_LIBCPP_HIDE_FROM_ABI inline constexpr bool77operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept {78return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();79}8081_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last82operator/(const month& __lhs, const weekday_last& __rhs) noexcept {83return month_weekday_last{__lhs, __rhs};84}8586_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept {87return month_weekday_last{month(__lhs), __rhs};88}8990_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last91operator/(const weekday_last& __lhs, const month& __rhs) noexcept {92return month_weekday_last{__rhs, __lhs};93}9495_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept {96return month_weekday_last{month(__rhs), __lhs};97}98} // namespace chrono99100_LIBCPP_END_NAMESPACE_STD101102#endif // _LIBCPP_STD_VER >= 20103104#endif // _LIBCPP___CHRONO_MONTH_WEEKDAY_H105106107