File indexing completed on 2025-01-18 09:30:38
0001
0002
0003
0004
0005
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
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
0030
0031
0032
0033
0034
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 } }
0072
0073
0074
0075 #endif