Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:38

0001 #ifndef DATE_TIME_GREGORIAN_CALENDAR_HPP__
0002 #define DATE_TIME_GREGORIAN_CALENDAR_HPP__
0003 
0004 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
0005  * Use, modification and distribution is subject to the
0006  * Boost Software License, Version 1.0. (See accompanying
0007  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
0008  * Author: Jeff Garland
0009  * $Date$
0010  */
0011 
0012 #include <boost/date_time/compiler_config.hpp>
0013 
0014 namespace boost {
0015 namespace date_time {
0016 
0017 
0018   //! An implementation of the Gregorian calendar
0019   /*! This is a parameterized implementation of a proleptic Gregorian Calendar that
0020       can be used in the creation of date systems or just to perform calculations.
0021       All the methods of this class are static functions, so the intent is to
0022       never create instances of this class.
0023     @tparam ymd_type_ Struct type representing the year, month, day.  The ymd_type must
0024            define a of types for the year, month, and day.  These types need to be
0025            arithmetic types.
0026     @tparam date_int_type_ Underlying type for the date count.  Must be an arithmetic type.
0027   */
0028   template<typename ymd_type_, typename date_int_type_>
0029   class BOOST_SYMBOL_VISIBLE gregorian_calendar_base {
0030   public:
0031     //! define a type a date split into components
0032     typedef ymd_type_  ymd_type;
0033     //! define a type for representing months
0034     typedef typename ymd_type::month_type  month_type;
0035     //! define a type for representing days
0036     typedef typename ymd_type::day_type  day_type;
0037     //! Type to hold a stand alone year value (eg: 2002)
0038     typedef typename ymd_type::year_type  year_type;
0039     //! Define the integer type to use for internal calculations
0040     typedef date_int_type_ date_int_type;
0041 
0042 
0043     static BOOST_CXX14_CONSTEXPR unsigned short day_of_week(const ymd_type& ymd);
0044     static BOOST_CXX14_CONSTEXPR int week_number(const ymd_type&ymd);
0045     static BOOST_CXX14_CONSTEXPR date_int_type day_number(const ymd_type& ymd);
0046     static BOOST_CXX14_CONSTEXPR date_int_type julian_day_number(const ymd_type& ymd);
0047     static BOOST_CXX14_CONSTEXPR date_int_type modjulian_day_number(const ymd_type& ymd);
0048     static BOOST_CXX14_CONSTEXPR ymd_type from_day_number(date_int_type);
0049     static BOOST_CXX14_CONSTEXPR ymd_type from_julian_day_number(date_int_type);
0050     static BOOST_CXX14_CONSTEXPR ymd_type from_modjulian_day_number(date_int_type);
0051     static BOOST_CXX14_CONSTEXPR bool is_leap_year(year_type);
0052     static BOOST_CXX14_CONSTEXPR unsigned short end_of_month_day(year_type y, month_type m);
0053     static BOOST_CXX14_CONSTEXPR ymd_type epoch();
0054     static BOOST_CXX14_CONSTEXPR unsigned short days_in_week();
0055 
0056   };
0057 
0058 
0059 
0060 } } //namespace
0061 
0062 #include "boost/date_time/gregorian_calendar.ipp"
0063 
0064 
0065 
0066 
0067 #endif
0068 
0069