Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ > Class Template Reference

An implementation of the Gregorian calendar. More...

#include <gregorian_calendar.hpp>

Inheritance diagram for boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >:

Public Types

typedef ymd_type_ ymd_type
 define a type a date split into components More...
 
typedef ymd_type::month_type month_type
 define a type for representing months More...
 
typedef ymd_type::day_type day_type
 define a type for representing days More...
 
typedef ymd_type::year_type year_type
 Type to hold a stand alone year value (eg: 2002) More...
 
typedef date_int_type_ date_int_type
 Define the integer type to use for internal calculations. More...
 

Static Public Member Functions

static unsigned short day_of_week (const ymd_type &ymd)
 Return the day of the week (0==Sunday, 1==Monday, etc) More...
 
static int week_number (const ymd_type &ymd)
 Return the iso week number for the date. More...
 
static date_int_type day_number (const ymd_type &ymd)
 Convert a ymd_type into a day number. More...
 
static date_int_type julian_day_number (const ymd_type &ymd)
 Convert a year-month-day into the julian day number. More...
 
static date_int_type modjulian_day_number (const ymd_type &ymd)
 Convert year-month-day into a modified julian day number. More...
 
static ymd_type from_day_number (date_int_type)
 Change a day number into a year-month-day. More...
 
static ymd_type from_julian_day_number (date_int_type)
 Change a day number into a year-month-day. More...
 
static ymd_type from_modjulian_day_number (date_int_type)
 Change a modified julian day number into a year-month-day. More...
 
static bool is_leap_year (year_type)
 Determine if the provided year is a leap year. More...
 
static unsigned short end_of_month_day (year_type y, month_type m)
 Calculate the last day of the month. More...
 
static ymd_type epoch ()
 Provide the ymd_type specification for the calandar start. More...
 
static unsigned short days_in_week ()
 Defines length of a week for week calculations. More...
 

Detailed Description

template<typename ymd_type_, typename date_int_type_>
class boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >

An implementation of the Gregorian calendar.

This is a parameterized implementation of a proleptic Gregorian Calendar that can be used in the creation of date systems or just to perform calculations. All the methods of this class are static functions, so the intent is to never create instances of this class.

Parameters
ymd_type_Struct type representing the year, month, day. The ymd_type must define a of types for the year, month, and day. These types need to be arithmetic types.
date_int_type_Underlying type for the date count. Must be an arithmetic type.

Member Typedef Documentation

template<typename ymd_type_, typename date_int_type_>
typedef date_int_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::date_int_type

Define the integer type to use for internal calculations.

template<typename ymd_type_, typename date_int_type_>
typedef ymd_type::day_type boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::day_type

define a type for representing days

template<typename ymd_type_, typename date_int_type_>
typedef ymd_type::month_type boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::month_type

define a type for representing months

template<typename ymd_type_, typename date_int_type_>
typedef ymd_type::year_type boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::year_type

Type to hold a stand alone year value (eg: 2002)

template<typename ymd_type_, typename date_int_type_>
typedef ymd_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::ymd_type

define a type a date split into components

Member Function Documentation

template<typename ymd_type_ , typename date_int_type_ >
date_int_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::day_number ( const ymd_type ymd)
inlinestatic

Convert a ymd_type into a day number.

The day number is an absolute number of days since the start of count

References boost::a, and boost::polygon::y().

template<typename ymd_type_ , typename date_int_type_ >
unsigned short boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::day_of_week ( const ymd_type ymd)
inlinestatic

Return the day of the week (0==Sunday, 1==Monday, etc)

Converts a year-month-day into a day of the week number

References boost::a, and boost::polygon::y().

template<typename ymd_type_ , typename date_int_type_ >
unsigned short boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::days_in_week ( )
inlinestatic

Defines length of a week for week calculations.

template<typename ymd_type_ , typename date_int_type_ >
unsigned short boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::end_of_month_day ( year_type  year,
month_type  month 
)
inlinestatic

Calculate the last day of the month.

Find the day which is the end of the month given year and month No error checking is performed.

template<typename ymd_type_ , typename date_int_type_ >
ymd_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::epoch ( )
inlinestatic

Provide the ymd_type specification for the calandar start.

template<typename ymd_type_ , typename date_int_type_ >
ymd_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::from_day_number ( date_int_type  dayNumber)
inlinestatic
template<typename ymd_type_ , typename date_int_type_ >
ymd_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::from_julian_day_number ( date_int_type  dayNumber)
inlinestatic
template<typename ymd_type_ , typename date_int_type_ >
ymd_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::from_modjulian_day_number ( date_int_type  dayNumber)
inlinestatic

Change a modified julian day number into a year-month-day.

template<typename ymd_type_ , typename date_int_type_ >
bool boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::is_leap_year ( year_type  year)
inlinestatic

Determine if the provided year is a leap year.

Returns
true if year is a leap year, false otherwise
template<typename ymd_type_ , typename date_int_type_ >
date_int_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::julian_day_number ( const ymd_type ymd)
inlinestatic

Convert a year-month-day into the julian day number.

Since this implementation uses julian day internally, this is the same as the day_number.

template<typename ymd_type_ , typename date_int_type_ >
date_int_type_ boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::modjulian_day_number ( const ymd_type ymd)
inlinestatic

Convert year-month-day into a modified julian day number.

The day number is an absolute number of days. MJD 0 thus started on 17 Nov 1858(Gregorian) at 00:00:00 UTC

template<typename ymd_type_ , typename date_int_type_ >
int boost::date_time::gregorian_calendar_base< ymd_type_, date_int_type_ >::week_number ( const ymd_type ymd)
inlinestatic

Return the iso week number for the date.

Implements the rules associated with the iso 8601 week number. Basically the rule is that Week 1 of the year is the week that contains January 4th or the week that contains the first Thursday in January. Reference for this algorithm is the Calendar FAQ by Claus Tondering, April 2000.

References boost::date_time::day, and boost::date_time::week.


The documentation for this class was generated from the following files: