123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #ifndef DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__
- #define DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__
- namespace boost {
- namespace date_time {
-
- template<class date_type>
- class dst_day_calc_rule
- {
- public:
- typedef typename date_type::year_type year_type;
- virtual ~dst_day_calc_rule() {};
- virtual date_type start_day(year_type y) const=0;
- virtual std::string start_rule_as_string() const=0;
- virtual date_type end_day(year_type y) const=0;
- virtual std::string end_rule_as_string() const=0;
- };
-
-
- template<class spec>
- class day_calc_dst_rule : public dst_day_calc_rule<typename spec::date_type>
- {
- public:
- typedef typename spec::date_type date_type;
- typedef typename date_type::year_type year_type;
- typedef typename spec::start_rule start_rule;
- typedef typename spec::end_rule end_rule;
- day_calc_dst_rule(start_rule dst_start,
- end_rule dst_end) :
- dst_start_(dst_start),
- dst_end_(dst_end)
- {}
- virtual date_type start_day(year_type y) const
- {
- return dst_start_.get_date(y);
- }
- virtual std::string start_rule_as_string() const
- {
- return dst_start_.to_string();
- }
- virtual date_type end_day(year_type y) const
- {
- return dst_end_.get_date(y);
- }
- virtual std::string end_rule_as_string() const
- {
- return dst_end_.to_string();
- }
- private:
- start_rule dst_start_;
- end_rule dst_end_;
- };
- } }
- #endif
|