89 lines
2.5 KiB
C++
89 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#define EXERCISM_RUN_ALL_TESTS
|
|
|
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
|
|
|
namespace meetup {
|
|
|
|
typedef boost::gregorian::date date_t;
|
|
typedef date_t::month_type month_t;
|
|
typedef date_t::year_type year_t;
|
|
|
|
class scheduler
|
|
{
|
|
public:
|
|
|
|
|
|
scheduler(month_t month, year_t year);
|
|
|
|
|
|
date_t monteenth() const;
|
|
date_t tuesteenth() const;
|
|
date_t wednesteenth() const;
|
|
date_t thursteenth() const;
|
|
date_t friteenth() const;
|
|
date_t saturteenth() const;
|
|
date_t sunteenth() const;
|
|
|
|
date_t first_monday() const;
|
|
date_t first_tuesday() const;
|
|
date_t first_wednesday() const;
|
|
date_t first_thursday() const;
|
|
date_t first_friday() const;
|
|
date_t first_saturday() const;
|
|
date_t first_sunday() const;
|
|
|
|
date_t second_monday() const;
|
|
date_t second_tuesday() const;
|
|
date_t second_wednesday() const;
|
|
date_t second_thursday() const;
|
|
date_t second_friday() const;
|
|
date_t second_saturday() const;
|
|
date_t second_sunday() const;
|
|
|
|
date_t third_monday() const;
|
|
date_t third_tuesday() const;
|
|
date_t third_wednesday() const;
|
|
date_t third_thursday() const;
|
|
date_t third_friday() const;
|
|
date_t third_saturday() const;
|
|
date_t third_sunday() const;
|
|
|
|
date_t fourth_monday() const;
|
|
date_t fourth_tuesday() const;
|
|
date_t fourth_wednesday() const;
|
|
date_t fourth_thursday() const;
|
|
date_t fourth_friday() const;
|
|
date_t fourth_saturday() const;
|
|
date_t fourth_sunday() const;
|
|
|
|
date_t last_monday() const;
|
|
date_t last_tuesday() const;
|
|
date_t last_wednesday() const;
|
|
date_t last_thursday() const;
|
|
date_t last_friday() const;
|
|
date_t last_saturday() const;
|
|
date_t last_sunday() const;
|
|
|
|
private:
|
|
|
|
typedef boost::date_time::weekdays weekdays;
|
|
typedef boost::gregorian::nth_day_of_the_week_in_month nth_dow;
|
|
typedef nth_dow::week_num week_num;
|
|
|
|
date_t teenth_day(weekdays day) const;
|
|
|
|
date_t nth_weekday(week_num n, weekdays day) const;
|
|
|
|
date_t first_weekday(weekdays day) const;
|
|
date_t second_weekday(weekdays day) const;
|
|
date_t third_weekday(weekdays day) const;
|
|
date_t fourth_weekday(weekdays day) const;
|
|
date_t last_weekday(weekdays day) const;
|
|
|
|
const year_t year_;
|
|
const month_t month_;
|
|
};
|
|
|
|
}
|