src/ai/api/ai_date.hpp
author truebrain
Wed, 23 Apr 2008 12:05:32 +0000
branchnoai
changeset 10308 0c81dfce3e9b
parent 9835 2541c2d325ed
permissions -rw-r--r--
(svn r12849) [NoAI] -Fix: when .hpp.sq doesn't exists, don't run diff (tnx to Yexo)
9825
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     1
/* $Id$ */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     2
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9825
diff changeset
     3
/** @file ai_date.hpp Everything to query and manipulate date related information. */
9825
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     4
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     5
#ifndef AI_DATE_HPP
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     6
#define AI_DATE_HPP
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     7
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     8
#include "ai_object.hpp"
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
     9
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    10
/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    11
 * Class that handles all date related (calculation) functions.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    12
 *
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    13
 * @note Months and days of month are 1-based; the first month of the
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    14
 *       year is 1 and the first day of the month is also 1.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    15
 * @note Years are zero based; they start with the year 0.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    16
 * @note Dates can be used to determine the number of days between
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    17
 *       two different moments in time because they count the number
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    18
 *       of days since the year 0.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    19
 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    20
class AIDate : public AIObject {
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    21
public:
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    22
	static const char *GetClassName() { return "AIDate"; }
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    23
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    24
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    25
	 * Get the current date.
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    26
	 * This is the number of days since epoch under the assumption that
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    27
	 *  there is a leap year every 4 years, except when dividable by
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    28
	 *  100 but not by 400.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    29
	 * @return The current date.
9825
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    30
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    31
	static int32 GetCurrentDate();
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    32
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    33
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    34
	 * Get the year of the given date.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    35
	 * @param date The date to get the year of.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    36
	 * @return The year.
9825
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    37
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    38
	static int32 GetYear(int32 date);
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    39
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    40
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    41
	 * Get the month of the given date.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    42
	 * @param date The date to get the month of.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    43
	 * @return The month.
9825
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    44
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    45
	static int32 GetMonth(int32 date);
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    46
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    47
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    48
	 * Get the day (of the month) of the given date.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    49
	 * @param date The date to get the day of.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    50
	 * @return The day.
9825
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    51
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    52
	static int32 GetDayOfMonth(int32 date);
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    53
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    54
	/**
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    55
	 * Get the date given a year, month and day of month.
9835
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    56
	 * @param year The year of the to-be determined date.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    57
	 * @param month The month of the to-be determined date.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    58
	 * @param day_of_month The day of month of the to-be determined date.
2541c2d325ed (svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents: 9829
diff changeset
    59
	 * @return The date.
9825
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    60
	 */
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    61
	static int32 GetDate(int32 year, int32 month, int32 day_of_month);
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    62
};
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    63
cc77111ebd85 (svn r12437) [NoAI] -Add: functions to get the current date and to determine the year/month/day from that date.
rubidium
parents:
diff changeset
    64
#endif /* AI_DATE_HPP */