// 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 "global.hpp" #include "SimpleString.hpp" namespace Calendar { // 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 Calendar.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); SimpleString toEnglish(INT yyyy, SHORT mm, SHORT dd); SimpleString toString(INT yyyy, SHORT mm, SHORT dd); }; #endif