HatchKeeper  0.90
The Free Open-Source Egg Incubation Software
Date.h
Go to the documentation of this file.
1 
6 #ifndef _DATE_H__
7 #define _DATE_H__
8 
9 #include <ctime>
10 #include <string>
11 #include <vector>
12 
13 const int HK_DateMode_MDY = 0; //MM/DD/YYYY
14 const int HK_DateMode_YMD = 1; //YYYY/MM/DD
15 const int HK_DateMode_DMY = 2; //DD/MM/YYYY
16 
25 class HK_Date{
26  private:
27  //Variables
28  int HK_Day;
29  int HK_Month;
30  int HK_Year;
31  public:
32  HK_Date();
33  HK_Date(int Days, int Month, int Year);
34  HK_Date(std::string Date);
35  ~HK_Date();
36 
37  bool AddDays(int Days);
38 
39  //std::string DateToReadable(int Day, int Month, int Year,std::string Separator);
40  int DaysInMonth();
41  int Difference(HK_Date Date);
42 
43  int GetDay();
44  int GetMonth();
45  int GetYear();
46 
47  std::string IntToMonth(int Month);
48  bool IsAfter(HK_Date Date);
49  bool IsBefore(HK_Date Date);
50  bool IsEqual(HK_Date Date);
51  bool IsEqualMonth(HK_Date Date);
52  bool IsEqualYear(HK_Date Date);
53  bool IsLeapYear();
54  bool IsValid();
55  bool IsValidDate(int Days, int Month, int Year);
56 
57  bool ModifyDate(int Days, bool Operator);
58  std::string MonthName();
59  int MonthToInt(std::string Month);
60 
61  void Reset();
62 
63  bool SetDate(int Days, int Month, int Year);
64  bool SetDate(std::string Date);
65  void SetDay(int Days);
66  void SetMonth(int Month);
67  void SetYear(int Year);
68  std::vector<std::string> SplitStrings(std::string In, std::string Split);
69  int StartDayOfWeek();
70  bool SubtractDays(int Days);
71 
72  std::string ToReadable(std::string Separator,int Mode);
73  std::string ToSortable(std::string Separator);
74 };
75 
76 #endif
const int HK_DateMode_YMD
Definition: Date.h:14
const int HK_DateMode_MDY
Definition: Date.h:13
const int HK_DateMode_DMY
Definition: Date.h:15
A Class For Managing Dates.
Definition: Date.h:25
int GetMonth()
Returns Month Value.
Definition: HK_Date.cpp:60
~HK_Date()
Destructor.
Definition: HK_Date.cpp:29
int HK_Month
Holds The Month Part Of The Date.
Definition: Date.h:29
void SetMonth(int Month)
Sets Month Value, Doesn't Check If Its Valid.
Definition: HK_Date.cpp:51
int Difference(HK_Date Date)
Returns The Number Of Days Difference Between This HK_Date And The Supplied Date.
Definition: HK_Date.cpp:84
bool IsEqualMonth(HK_Date Date)
Checks To See If The Input Date's Month and Year Is Same As Stored Date.
Definition: HK_Date.cpp:336
bool IsLeapYear()
Returns True If HK_Year Is A Leap Year.
Definition: HK_Date.cpp:423
std::string MonthName()
Returns HK_Month's Name As String.
Definition: HK_Date.cpp:188
int HK_Year
Holds The Year Part Of The Date.
Definition: Date.h:30
void Reset()
Resets Date To Today.
Definition: HK_Date.cpp:400
std::string ToSortable(std::string Separator)
Generate A Sortable String For Database.
Definition: HK_Date.cpp:163
bool SubtractDays(int Days)
Subtracts Days To This HK_Date.
Definition: HK_Date.cpp:79
bool IsBefore(HK_Date Date)
Checks To See If The Input Date Is Before The Stored Date.
Definition: HK_Date.cpp:289
void SetDay(int Days)
Sets Day Value, Doesn't Check If Its Valid.
Definition: HK_Date.cpp:48
std::string ToReadable(std::string Separator, int Mode)
Generate A Readable String.
Definition: HK_Date.cpp:132
int StartDayOfWeek()
Returns What Day Of The Week This HK_Date Month Starts.
Definition: HK_Date.cpp:411
bool AddDays(int Days)
Adds Days To This HK_Date.
Definition: HK_Date.cpp:70
bool IsEqualYear(HK_Date Date)
Checks To See If The Input Date's Year Is Same As Stored Date.
Definition: HK_Date.cpp:345
int HK_Day
Holds The Day Part Of The Date.
Definition: Date.h:28
bool IsValid()
Checks If This HK_Date Contains A Valid Date.
Definition: HK_Date.cpp:194
int GetDay()
Returns Day Value.
Definition: HK_Date.cpp:57
std::string IntToMonth(int Month)
Returns The Selected Month Name As A String. Expects 1 - 12.
Definition: HK_Date.cpp:168
HK_Date()
The Default Constructor. Sets Date To Today.
Definition: HK_Date.cpp:12
bool IsValidDate(int Days, int Month, int Year)
Takes Day, Month And Year And Generates A Readable String.
Definition: HK_Date.cpp:377
bool IsEqual(HK_Date Date)
Checks To See If The Input Date Is Same As Stored Date.
Definition: HK_Date.cpp:325
bool ModifyDate(int Days, bool Operator)
Adds Or Subtracts Days From This HK_Date.
Definition: HK_Date.cpp:207
int DaysInMonth()
Returns The Number Of Days In HK_Month. LeapYear Is Checked.
Definition: HK_Date.cpp:432
bool SetDate(int Days, int Month, int Year)
Sets Day, Month, and Year.
Definition: HK_Date.cpp:32
bool IsAfter(HK_Date Date)
Checks To See If The Input Date Is After The Stored Date.
Definition: HK_Date.cpp:253
int GetYear()
Returns Year Value.
Definition: HK_Date.cpp:63
void SetYear(int Year)
Sets Year Value, Doesn't Check If Its Valid.
Definition: HK_Date.cpp:54
std::vector< std::string > SplitStrings(std::string In, std::string Split)
Splits In By Split And Returns A Vector With Data.
Definition: HK_Date.cpp:444
int MonthToInt(std::string Month)
Converts Month Name To An Int.
Definition: HK_Date.cpp:175