|
#ifndef _DOOMSDAYDATE_H_
#define _DOOMSDAYDATE_H_
#include "DoomsdayDateConst.h"
class DoomsdayDate
{
public:
//-----------------------------------------------------
// JulianBeforeGregorian refers to the weird dates
// between October 5-14, 1582 which were deleted from
// the Gregorian calendar. Technically the days never
// existed. The default is false which sets the date
// as invalid.
//-----------------------------------------------------
DoomsdayDate(bool JulianBeforeGregorian = true);
DoomsdayDate(int month, int day, int year, bool ad=true)
{
Set(month, day, year, ad);
}
DoomsdayDate(const DoomsdayDate& dd)
{
copy_(dd);
}
const DoomsdayDate& operator=(const DoomsdayDate& dd)
{
copy_(dd);
return *this;
}
bool AD() { return ad_; }
bool BC() { return !ad_; }
bool Set(int month, int day, int year, bool ad=true);
bool SetFirst(int weekday, int month, int year);
bool SetFourth(int weekday, int month, int year);
bool SetSecond(int weekday, int month, int year);
bool SetThird(int weekday, int month, int year);
const char* WeekdayStr(int weekDay);
const char* WeekdayStr() { return WeekdayStr(Weekday()); }
int GetDay() { return day_; }
int GetMonth() { return month_; }
int GetYear() { return year_; }
int Weekday();
void Print();
private:
void copy_(const DoomsdayDate& dd)
{
month_ = dd.month_;
day_ = dd.day_;
year_ = dd.year_;
ad_ = dd.ad_;
gregorian_ = dd.gregorian_;
valid_ = dd.valid_;
useJulianBeforeGregorian_ = dd.useJulianBeforeGregorian_;
weekday_ = dd.weekday_;
}
int DoomsdayCentury(int century);
int DoomsdayMonth(int month);
bool Gregorian(int month, int day, int year);
bool LeapYear(int year);
int month_;
int day_;
int year_;
int weekday_;
bool ad_;
bool gregorian_;
bool valid_;
bool useJulianBeforeGregorian_;
};
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.