Chris@16
|
1 #ifndef DATE_TIME_TIME_ITERATOR_HPP___
|
Chris@16
|
2 #define DATE_TIME_TIME_ITERATOR_HPP___
|
Chris@16
|
3
|
Chris@16
|
4 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
|
Chris@16
|
5 * Use, modification and distribution is subject to the
|
Chris@16
|
6 * Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
7 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8 * Author: Jeff Garland, Bart Garst
|
Chris@101
|
9 * $Date$
|
Chris@16
|
10 */
|
Chris@16
|
11
|
Chris@16
|
12
|
Chris@16
|
13 namespace boost {
|
Chris@16
|
14 namespace date_time {
|
Chris@16
|
15
|
Chris@16
|
16
|
Chris@16
|
17 //! Simple time iterator skeleton class
|
Chris@16
|
18 template<class time_type>
|
Chris@16
|
19 class time_itr {
|
Chris@16
|
20 public:
|
Chris@16
|
21 typedef typename time_type::time_duration_type time_duration_type;
|
Chris@16
|
22 time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {}
|
Chris@16
|
23 time_itr& operator++()
|
Chris@16
|
24 {
|
Chris@16
|
25 current_ = current_ + offset_;
|
Chris@16
|
26 return *this;
|
Chris@16
|
27 }
|
Chris@16
|
28 time_itr& operator--()
|
Chris@16
|
29 {
|
Chris@16
|
30 current_ = current_ - offset_;
|
Chris@16
|
31 return *this;
|
Chris@16
|
32 }
|
Chris@16
|
33 time_type operator*() {return current_;}
|
Chris@16
|
34 time_type* operator->() {return ¤t_;}
|
Chris@16
|
35 bool operator< (const time_type& t) {return current_ < t;}
|
Chris@16
|
36 bool operator<= (const time_type& t) {return current_ <= t;}
|
Chris@16
|
37 bool operator!= (const time_type& t) {return current_ != t;}
|
Chris@16
|
38 bool operator== (const time_type& t) {return current_ == t;}
|
Chris@16
|
39 bool operator> (const time_type& t) {return current_ > t;}
|
Chris@16
|
40 bool operator>= (const time_type& t) {return current_ >= t;}
|
Chris@16
|
41
|
Chris@16
|
42 private:
|
Chris@16
|
43 time_type current_;
|
Chris@16
|
44 time_duration_type offset_;
|
Chris@16
|
45 };
|
Chris@16
|
46
|
Chris@16
|
47
|
Chris@16
|
48
|
Chris@16
|
49 } }//namespace date_time
|
Chris@16
|
50
|
Chris@16
|
51
|
Chris@16
|
52 #endif
|