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::partial_date< date_type > Class Template Reference

Generates a date by applying the year to the given month and day. More...

#include <date_generators.hpp>

Inheritance diagram for boost::date_time::partial_date< date_type >:
Collaboration diagram for boost::date_time::partial_date< date_type >:

Public Types

typedef date_type::calendar_type calendar_type
 
typedef calendar_type::day_type day_type
 
typedef calendar_type::month_type month_type
 
typedef calendar_type::year_type year_type
 
typedef date_type::duration_type duration_type
 
typedef duration_type::duration_rep duration_rep
 

Public Member Functions

 partial_date (day_type d, month_type m)
 
 partial_date (duration_rep days)
 Partial date created from number of days into year. Range 1-366. More...
 
date_type get_date (year_type y) const
 Return a concrete date when provided with a year specific year. More...
 
date_type operator() (year_type y) const
 
bool operator== (const partial_date &rhs) const
 
bool operator< (const partial_date &rhs) const
 
month_type month () const
 
day_type day () const
 
virtual std::string to_string () const
 Returns string suitable for use in POSIX time zone string. More...
 

Detailed Description

template<class date_type>
class boost::date_time::partial_date< date_type >

Generates a date by applying the year to the given month and day.

Example usage:

partial_date pd2(70);
date d = pd.get_date(2002); //2002-Jan-01
date d2 = pd2.get_date(2002); //2002-Mar-10

Member Typedef Documentation

template<class date_type >
typedef date_type::calendar_type boost::date_time::partial_date< date_type >::calendar_type
template<class date_type >
typedef calendar_type::day_type boost::date_time::partial_date< date_type >::day_type
template<class date_type >
typedef duration_type::duration_rep boost::date_time::partial_date< date_type >::duration_rep
template<class date_type >
typedef date_type::duration_type boost::date_time::partial_date< date_type >::duration_type
template<class date_type >
typedef calendar_type::month_type boost::date_time::partial_date< date_type >::month_type
template<class date_type >
typedef calendar_type::year_type boost::date_time::partial_date< date_type >::year_type

Constructor & Destructor Documentation

template<class date_type >
boost::date_time::partial_date< date_type >::partial_date ( day_type  d,
month_type  m 
)
inline
template<class date_type >
boost::date_time::partial_date< date_type >::partial_date ( duration_rep  days)
inline

Partial date created from number of days into year. Range 1-366.

Allowable values range from 1 to 366. 1=Jan1, 366=Dec31. If argument exceeds range, partial_date will be created with closest in-range value. 60 will always be Feb29, if get_date() is called with a non-leap year an exception will be thrown

Member Function Documentation

template<class date_type >
date_type boost::date_time::partial_date< date_type >::get_date ( year_type  y) const
inlinevirtual

Return a concrete date when provided with a year specific year.

Will throw an 'invalid_argument' exception if a partial_date object, instantiated with Feb-29, has get_date called with a non-leap year. Example:

partial_date pd(29, Feb);
pd.get_date(2003); // throws invalid_argument exception
pg.get_date(2000); // returns 2000-2-29

Implements boost::date_time::year_based_generator< date_type >.

References boost::asio::error::invalid_argument, and boost::throw_exception().

Referenced by boost::date_time::partial_date< date_type >::operator()().

template<class date_type >
date_type boost::date_time::partial_date< date_type >::operator() ( year_type  y) const
inline
template<class date_type >
bool boost::date_time::partial_date< date_type >::operator< ( const partial_date< date_type > &  rhs) const
inline
template<class date_type >
bool boost::date_time::partial_date< date_type >::operator== ( const partial_date< date_type > &  rhs) const
inline
template<class date_type >
virtual std::string boost::date_time::partial_date< date_type >::to_string ( ) const
inlinevirtual

Returns string suitable for use in POSIX time zone string.

Returns string formatted with up to 3 digits: Jan-01 == "0" Feb-29 == "58" Dec-31 == "365"

Implements boost::date_time::year_based_generator< date_type >.

References boost::multiprecision::backends::c.


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