|
1 /* $Id$ */ |
|
2 |
|
3 /** @file ai_date.hpp declaration of class for AIDate class */ |
|
4 |
|
5 #ifndef AI_DATE_HPP |
|
6 #define AI_DATE_HPP |
|
7 |
|
8 #include "ai_object.hpp" |
|
9 |
|
10 /** |
|
11 * Class that handles all date related (calculation) functions. |
|
12 * |
|
13 * @note Months and days of month are 1-based; the first month of the |
|
14 * year is 1 and the first day of the month is also 1. |
|
15 * @note Years are zero based; they start with the year 0. |
|
16 * @note Dates can be used to determine the number of days between |
|
17 * two different moments in time because they count the number |
|
18 * of days since the year 0. |
|
19 */ |
|
20 class AIDate : public AIObject { |
|
21 public: |
|
22 /** |
|
23 * The name of the class, needed by several sub-processes. |
|
24 */ |
|
25 static const char *GetClassName() { return "AIDate"; } |
|
26 |
|
27 /** |
|
28 * Get the current date. |
|
29 * This is the number of days since epoch under the assumption that |
|
30 * there is a leap year every 4 years, except when dividable by |
|
31 * 100 but not by 400. |
|
32 * @return a date. |
|
33 */ |
|
34 static int32 GetCurrentDate(); |
|
35 |
|
36 /** |
|
37 * Get the year of the given date. |
|
38 * @param date the date to get the year of. |
|
39 * @return the year. |
|
40 */ |
|
41 static int32 GetYear(int32 date); |
|
42 |
|
43 /** |
|
44 * Get the month of the given date. |
|
45 * @param date the date to get the month of. |
|
46 * @return the month. |
|
47 */ |
|
48 static int32 GetMonth(int32 date); |
|
49 |
|
50 /** |
|
51 * Get the day (of the month) of the given date. |
|
52 * @param date the date to get the day of. |
|
53 * @return the day. |
|
54 */ |
|
55 static int32 GetDayOfMonth(int32 date); |
|
56 |
|
57 /** |
|
58 * Get the date given a year, month and day of month. |
|
59 * @param year the year of the to-be determined date. |
|
60 * @param month the month of the to-be determined date. |
|
61 * @param day_of_month the day of month of the to-be determined date. |
|
62 * @return the date. |
|
63 */ |
|
64 static int32 GetDate(int32 year, int32 month, int32 day_of_month); |
|
65 }; |
|
66 |
|
67 #endif /* AI_DATE_HPP */ |