PrevUpHomeNext

Class month_weekday_iterator

fd::gregorian::month_weekday_iterator — Weekday-of-month iterator, which stays at the weekday of month specified at construction time, with the ability to add an optional number of days to the resulting date.

Synopsis

// In header: <fd/date_iterators.h>


class month_weekday_iterator : public fd::gregorian::date_iterator_interface {
public:

  // public member functions
  month_weekday_iterator(date_type, int, nth_kday_of_month::week_num, 
                         boost::date_time::weekdays);
  duration_type get_offset(const date_type &) const;
  duration_type get_neg_offset(const date_type &) const;
  constexpr nth_kday_of_month::week_num origin_week_no() const;
  constexpr boost::date_time::weekdays origin_week_day() const;

  // private member functions
  duration_type 
  offset(const date_type &, 
         int(boost::date_time::wrapping_int2< short, 1, 12 >::*)(int)) const;
};

Description

month_weekday_iterator public member functions

  1. month_weekday_iterator(date_type d, int f, 
                           nth_kday_of_month::week_num originWeekNo, 
                           boost::date_time::weekdays originWeekday);

    Parameters:

    d

    Current date (year, month) where to set up the iterator.

    f

    Factor, i.e. how many month to forward on each iteration.

    originWeekNo

    The week number of a month [1..5] to set up the iterator.

    originWeekday

    The day of week [0..6] to set up the iterator.

  2. duration_type get_offset(const date_type & current) const;
  3. duration_type get_neg_offset(const date_type & current) const;
  4. constexpr nth_kday_of_month::week_num origin_week_no() const;
  5. constexpr boost::date_time::weekdays origin_week_day() const;

month_weekday_iterator private member functions

  1. duration_type 
    offset(const date_type & current, 
           int(boost::date_time::wrapping_int2< short, 1, 12 >::*)(int) add_or_sub) const;

PrevUpHomeNext