Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
0002  * Use, modification and distribution is subject to the 
0003  * Boost Software License, Version 1.0. (See accompanying
0004  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
0005  * Author: Jeff Garland, Bart Garst
0006  */
0007 #ifndef DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__
0008 #define DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__
0009 
0010 #include <string>
0011 
0012 namespace boost {
0013 namespace date_time {
0014 
0015     //! Defines base interface for calculating start and end date of daylight savings 
0016     template<class date_type>
0017     class dst_day_calc_rule 
0018     {
0019     public:
0020       typedef typename date_type::year_type year_type;
0021       virtual ~dst_day_calc_rule() {}
0022       virtual date_type start_day(year_type y) const=0;
0023       virtual std::string start_rule_as_string() const=0;
0024       virtual date_type end_day(year_type y) const=0;
0025       virtual std::string end_rule_as_string() const=0;
0026 
0027     };
0028 
0029     //! Canonical form for a class that provides day rule calculation
0030     /*! This class is used to generate specific sets of dst rules
0031      *  
0032      *@tparam spec Provides a specifiction of the function object types used
0033      *            to generate start and end days of daylight savings as well
0034      *            as the date type.
0035      */
0036     template<class spec>
0037     class day_calc_dst_rule : public dst_day_calc_rule<typename spec::date_type>
0038     {
0039     public:
0040       typedef typename spec::date_type date_type;
0041       typedef typename date_type::year_type year_type;
0042       typedef typename spec::start_rule start_rule;
0043       typedef typename spec::end_rule  end_rule;
0044       day_calc_dst_rule(start_rule dst_start,
0045                         end_rule dst_end) :
0046         dst_start_(dst_start),
0047         dst_end_(dst_end)
0048       {}
0049       virtual date_type start_day(year_type y) const
0050       {
0051         return dst_start_.get_date(y);
0052       }
0053       virtual std::string start_rule_as_string() const
0054       {
0055         return dst_start_.to_string();
0056       }
0057       virtual date_type end_day(year_type y) const
0058       {
0059         return dst_end_.get_date(y);
0060       }
0061       virtual std::string end_rule_as_string() const
0062       {
0063         return dst_end_.to_string();
0064       }
0065     private:
0066       start_rule dst_start_;
0067       end_rule dst_end_;
0068     };
0069 
0070 
0071 } }//namespace
0072 
0073 
0074 
0075 #endif