// Calendar Information (copyright 1992, Information Disciplines, Inc.) // -------------------- // This pseudo-class defines public constants and utility functions // used in manipulating dates. It is independent of any date representation // or Date class. (It is used by IDI's Date class -- see Date.hpp.) #ifndef CALENDAR #define CALENDAR #include "SimpleString.hpp" namespace CalendarInfo { // Constants // --------- static SHORT DAYS_PER_YEAR = 365; static LONG DAYS_PER_4_YEARS = 1 + 4 * DAYS_PER_YEAR; static LONG DAYS_PER_100_YEARS = -1 + 25 * DAYS_PER_4_YEARS; static LONG DAYS_PER_400_YEARS = 1 + 4 * DAYS_PER_100_YEARS; static SHORT DAYS_IN_MONTH [13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; static SHORT DAYS_BEFORE_MONTH [13] = {0, 0, 31, 59, 90,120,151, 181,212,243,273,304,334}; static const char *const MONTH_NAME [13] = {"","January", "February", "March" , "April" , "May" , "June" , "July" , "August" , "September", "October", "November", "December"}; static const char *const DAY_NAME [ 7] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; // Utility function declarations (defined in CalendarInfo.cpp) // ----------------------------- bool isLeapYear(INT yyyy); bool isLegalYMD(INT yyyy, SHORT mm, SHORT dd); // Validate year-month-day short dayNumber(INT yyyy, INT mm, INT dd); void ymd (INT yyyy_in, short& mm_out, short& ddd_in_out);// inverse of // dayNumber SimpleString toEnglish(INT yyyy, SHORT mm, SHORT dd); SimpleString toString(INT yyyy, SHORT mm, SHORT dd); }; #endif