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::base_time< T, time_system > Class Template Reference

Representation of a precise moment in time, including the date. More...

#include <time.hpp>

Inheritance diagram for boost::date_time::base_time< T, time_system >:
Collaboration diagram for boost::date_time::base_time< T, time_system >:

Public Types

typedef T time_type
 
typedef time_system::time_rep_type time_rep_type
 
typedef time_system::date_type date_type
 
typedef
time_system::date_duration_type 
date_duration_type
 
typedef
time_system::time_duration_type 
time_duration_type
 

Public Member Functions

 base_time (const date_type &day, const time_duration_type &td, dst_flags dst=not_dst)
 
 base_time (special_values sv)
 
 base_time (const time_rep_type &rhs)
 
date_type date () const
 
time_duration_type time_of_day () const
 
std::string zone_name (bool=false) const
 Optional bool parameter will return time zone as an offset (ie "+07:00"). More...
 
std::string zone_abbrev (bool=false) const
 Optional bool parameter will return time zone as an offset (ie "+07:00"). More...
 
std::string zone_as_posix_string () const
 An empty string is returned for classes that do not use a time_zone. More...
 
bool is_not_a_date_time () const
 check to see if date is not a value More...
 
bool is_infinity () const
 check to see if date is one of the infinity values More...
 
bool is_pos_infinity () const
 check to see if date is greater than all possible dates More...
 
bool is_neg_infinity () const
 check to see if date is greater than all possible dates More...
 
bool is_special () const
 check to see if time is a special value More...
 
bool operator== (const time_type &rhs) const
 Equality operator – others generated by boost::equality_comparable. More...
 
bool operator< (const time_type &rhs) const
 Equality operator – others generated by boost::less_than_comparable. More...
 
time_duration_type operator- (const time_type &rhs) const
 difference between two times More...
 
time_type operator+ (const date_duration_type &dd) const
 add date durations More...
 
time_type operator+= (const date_duration_type &dd)
 
time_type operator- (const date_duration_type &dd) const
 subtract date durations More...
 
time_type operator-= (const date_duration_type &dd)
 
time_type operator+ (const time_duration_type &td) const
 add time durations More...
 
time_type operator+= (const time_duration_type &td)
 
time_type operator- (const time_duration_type &rhs) const
 subtract time durations More...
 
time_type operator-= (const time_duration_type &td)
 

Protected Attributes

time_rep_type time_
 

Detailed Description

template<class T, class time_system>
class boost::date_time::base_time< T, time_system >

Representation of a precise moment in time, including the date.

This class is a skeleton for the interface of a temporal type with a resolution that is higher than a day. It is intended that this class be the base class and that the actual time class be derived using the BN pattern. In this way, the derived class can make decisions such as 'should there be a default constructor' and what should it set its value to, should there be optional constructors say allowing only an time_durations that generate a time from a clock,etc. So, in fact multiple time types can be created for a time_system with different construction policies, and all of them can perform basic operations by only writing a copy constructor. Finally, compiler errors are also shorter.

The real behavior of the time class is provided by the time_system template parameter. This class must provide all the logic for addition, subtraction, as well as define all the interface types.

Member Typedef Documentation

template<class T, class time_system>
typedef time_system::date_duration_type boost::date_time::base_time< T, time_system >::date_duration_type
template<class T, class time_system>
typedef time_system::date_type boost::date_time::base_time< T, time_system >::date_type
template<class T, class time_system>
typedef time_system::time_duration_type boost::date_time::base_time< T, time_system >::time_duration_type
template<class T, class time_system>
typedef time_system::time_rep_type boost::date_time::base_time< T, time_system >::time_rep_type
template<class T, class time_system>
typedef T boost::date_time::base_time< T, time_system >::time_type

Constructor & Destructor Documentation

template<class T, class time_system>
boost::date_time::base_time< T, time_system >::base_time ( const date_type day,
const time_duration_type td,
dst_flags  dst = not_dst 
)
inline
template<class T, class time_system>
boost::date_time::base_time< T, time_system >::base_time ( special_values  sv)
inline
template<class T, class time_system>
boost::date_time::base_time< T, time_system >::base_time ( const time_rep_type rhs)
inline

Member Function Documentation

template<class T, class time_system>
bool boost::date_time::base_time< T, time_system >::is_infinity ( ) const
inline

check to see if date is one of the infinity values

Referenced by boost::date_time::base_time< utc_time_, boost::posix_time::posix_time_system >::is_special().

template<class T, class time_system>
bool boost::date_time::base_time< T, time_system >::is_neg_infinity ( ) const
inline

check to see if date is greater than all possible dates

Referenced by boost::date_time::base_time< utc_time_, boost::posix_time::posix_time_system >::is_infinity().

template<class T, class time_system>
bool boost::date_time::base_time< T, time_system >::is_not_a_date_time ( ) const
inline
template<class T, class time_system>
bool boost::date_time::base_time< T, time_system >::is_pos_infinity ( ) const
inline
template<class T, class time_system>
bool boost::date_time::base_time< T, time_system >::is_special ( ) const
inline

check to see if time is a special value

Referenced by boost::serialization::save().

template<class T, class time_system>
time_type boost::date_time::base_time< T, time_system >::operator+ ( const date_duration_type dd) const
inline

add date durations

template<class T, class time_system>
time_type boost::date_time::base_time< T, time_system >::operator+ ( const time_duration_type td) const
inline

add time durations

template<class T, class time_system>
time_type boost::date_time::base_time< T, time_system >::operator+= ( const date_duration_type dd)
inline
template<class T, class time_system>
time_type boost::date_time::base_time< T, time_system >::operator+= ( const time_duration_type td)
inline
template<class T, class time_system>
time_duration_type boost::date_time::base_time< T, time_system >::operator- ( const time_type rhs) const
inline

difference between two times

template<class T, class time_system>
time_type boost::date_time::base_time< T, time_system >::operator- ( const date_duration_type dd) const
inline

subtract date durations

template<class T, class time_system>
time_type boost::date_time::base_time< T, time_system >::operator- ( const time_duration_type rhs) const
inline

subtract time durations

template<class T, class time_system>
time_type boost::date_time::base_time< T, time_system >::operator-= ( const date_duration_type dd)
inline
template<class T, class time_system>
time_type boost::date_time::base_time< T, time_system >::operator-= ( const time_duration_type td)
inline
template<class T, class time_system>
bool boost::date_time::base_time< T, time_system >::operator< ( const time_type rhs) const
inline

Equality operator – others generated by boost::less_than_comparable.

template<class T, class time_system>
bool boost::date_time::base_time< T, time_system >::operator== ( const time_type rhs) const
inline

Equality operator – others generated by boost::equality_comparable.

template<class T, class time_system>
std::string boost::date_time::base_time< T, time_system >::zone_abbrev ( bool  = false) const
inline

Optional bool parameter will return time zone as an offset (ie "+07:00").

Empty string is returned for classes that do not use a time_zone

template<class T, class time_system>
std::string boost::date_time::base_time< T, time_system >::zone_as_posix_string ( ) const
inline

An empty string is returned for classes that do not use a time_zone.

template<class T, class time_system>
std::string boost::date_time::base_time< T, time_system >::zone_name ( bool  = false) const
inline

Optional bool parameter will return time zone as an offset (ie "+07:00").

Empty string is returned for classes that do not use a time_zone

Member Data Documentation

template<class T, class time_system>
time_rep_type boost::date_time::base_time< T, time_system >::time_
protected

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