HatchKeeper  0.90
The Free Open-Source Egg Incubation Software
HK_Date Class Reference

A Class For Managing Dates. More...

#include <Date.h>

Public Member Functions

 HK_Date ()
 The Default Constructor. Sets Date To Today. More...
 
 HK_Date (int Days, int Month, int Year)
 A Constructor That Sets Day, Month, Year. Call IsValid() To Check If The Date Is Valid. More...
 
 HK_Date (std::string Date)
 A Constructor That Sets Date From A Year/Month/Day String. Call IsValid() To Check If The Date Is Valid. More...
 
 ~HK_Date ()
 Destructor. More...
 
bool AddDays (int Days)
 Adds Days To This HK_Date. More...
 
int DaysInMonth ()
 Returns The Number Of Days In HK_Month. LeapYear Is Checked. More...
 
int Difference (HK_Date Date)
 Returns The Number Of Days Difference Between This HK_Date And The Supplied Date. More...
 
int GetDay ()
 Returns Day Value. More...
 
int GetMonth ()
 Returns Month Value. More...
 
int GetYear ()
 Returns Year Value. More...
 
std::string IntToMonth (int Month)
 Returns The Selected Month Name As A String. Expects 1 - 12. More...
 
bool IsAfter (HK_Date Date)
 Checks To See If The Input Date Is After The Stored Date. More...
 
bool IsBefore (HK_Date Date)
 Checks To See If The Input Date Is Before The Stored Date. More...
 
bool IsEqual (HK_Date Date)
 Checks To See If The Input Date Is Same As Stored Date. More...
 
bool IsEqualMonth (HK_Date Date)
 Checks To See If The Input Date's Month and Year Is Same As Stored Date. More...
 
bool IsEqualYear (HK_Date Date)
 Checks To See If The Input Date's Year Is Same As Stored Date. More...
 
bool IsLeapYear ()
 Returns True If HK_Year Is A Leap Year. More...
 
bool IsValid ()
 Checks If This HK_Date Contains A Valid Date. More...
 
bool IsValidDate (int Days, int Month, int Year)
 Takes Day, Month And Year And Generates A Readable String. More...
 
bool ModifyDate (int Days, bool Operator)
 Adds Or Subtracts Days From This HK_Date. More...
 
std::string MonthName ()
 Returns HK_Month's Name As String. More...
 
int MonthToInt (std::string Month)
 Converts Month Name To An Int. More...
 
void Reset ()
 Resets Date To Today. More...
 
bool SetDate (int Days, int Month, int Year)
 Sets Day, Month, and Year. More...
 
bool SetDate (std::string Date)
 Sets Day, Month, and Year From A Year/Month/Day String. More...
 
void SetDay (int Days)
 Sets Day Value, Doesn't Check If Its Valid. More...
 
void SetMonth (int Month)
 Sets Month Value, Doesn't Check If Its Valid. More...
 
void SetYear (int Year)
 Sets Year Value, Doesn't Check If Its Valid. More...
 
std::vector< std::string > SplitStrings (std::string In, std::string Split)
 Splits In By Split And Returns A Vector With Data. More...
 
int StartDayOfWeek ()
 Returns What Day Of The Week This HK_Date Month Starts. More...
 
bool SubtractDays (int Days)
 Subtracts Days To This HK_Date. More...
 
std::string ToReadable (std::string Separator, int Mode)
 Generate A Readable String. More...
 
std::string ToSortable (std::string Separator)
 Generate A Sortable String For Database. More...
 

Private Attributes

int HK_Day
 Holds The Day Part Of The Date. More...
 
int HK_Month
 Holds The Month Part Of The Date. More...
 
int HK_Year
 Holds The Year Part Of The Date. More...
 

Detailed Description

A Class For Managing Dates.

This class only supports days, months, and years. It doesn't support hour, minutes, seconds, etc;

Definition at line 25 of file Date.h.

Constructor & Destructor Documentation

◆ HK_Date() [1/3]

HK_Date::HK_Date ( )

The Default Constructor. Sets Date To Today.

Definition at line 12 of file HK_Date.cpp.

◆ HK_Date() [2/3]

HK_Date::HK_Date ( int  Days,
int  Month,
int  Year 
)

A Constructor That Sets Day, Month, Year. Call IsValid() To Check If The Date Is Valid.

Definition at line 20 of file HK_Date.cpp.

◆ HK_Date() [3/3]

HK_Date::HK_Date ( std::string  Date)

A Constructor That Sets Date From A Year/Month/Day String. Call IsValid() To Check If The Date Is Valid.

Definition at line 26 of file HK_Date.cpp.

◆ ~HK_Date()

HK_Date::~HK_Date ( )

Destructor.

Definition at line 29 of file HK_Date.cpp.

Member Function Documentation

◆ AddDays()

bool HK_Date::AddDays ( int  Days)

Adds Days To This HK_Date.

Returns
True If Resulting Date Is Valid.
See also
ModifyDate()
SubtractDays()

Definition at line 70 of file HK_Date.cpp.

◆ DaysInMonth()

int HK_Date::DaysInMonth ( )

Returns The Number Of Days In HK_Month. LeapYear Is Checked.

Definition at line 432 of file HK_Date.cpp.

◆ Difference()

int HK_Date::Difference ( HK_Date  Date)

Returns The Number Of Days Difference Between This HK_Date And The Supplied Date.

Definition at line 84 of file HK_Date.cpp.

◆ GetDay()

int HK_Date::GetDay ( )

Returns Day Value.

Definition at line 57 of file HK_Date.cpp.

◆ GetMonth()

int HK_Date::GetMonth ( )

Returns Month Value.

Definition at line 60 of file HK_Date.cpp.

◆ GetYear()

int HK_Date::GetYear ( )

Returns Year Value.

Definition at line 63 of file HK_Date.cpp.

◆ IntToMonth()

std::string HK_Date::IntToMonth ( int  Month)

Returns The Selected Month Name As A String. Expects 1 - 12.

Definition at line 168 of file HK_Date.cpp.

◆ IsAfter()

bool HK_Date::IsAfter ( HK_Date  Date)

Checks To See If The Input Date Is After The Stored Date.

Definition at line 253 of file HK_Date.cpp.

◆ IsBefore()

bool HK_Date::IsBefore ( HK_Date  Date)

Checks To See If The Input Date Is Before The Stored Date.

Definition at line 289 of file HK_Date.cpp.

◆ IsEqual()

bool HK_Date::IsEqual ( HK_Date  Date)

Checks To See If The Input Date Is Same As Stored Date.

Definition at line 325 of file HK_Date.cpp.

◆ IsEqualMonth()

bool HK_Date::IsEqualMonth ( HK_Date  Date)

Checks To See If The Input Date's Month and Year Is Same As Stored Date.

Definition at line 336 of file HK_Date.cpp.

◆ IsEqualYear()

bool HK_Date::IsEqualYear ( HK_Date  Date)

Checks To See If The Input Date's Year Is Same As Stored Date.

Definition at line 345 of file HK_Date.cpp.

◆ IsLeapYear()

bool HK_Date::IsLeapYear ( )

Returns True If HK_Year Is A Leap Year.

Definition at line 423 of file HK_Date.cpp.

◆ IsValid()

bool HK_Date::IsValid ( )

Checks If This HK_Date Contains A Valid Date.

Returns
True If Valid.

Definition at line 194 of file HK_Date.cpp.

◆ IsValidDate()

bool HK_Date::IsValidDate ( int  Day,
int  Month,
int  Year 
)

Takes Day, Month And Year And Generates A Readable String.

Parameters
Separatori.e. "/" month/day/year
Returns
A Readable String

Checks If The Args Form A Valid Date

Returns
True If Date Is Valid

Definition at line 377 of file HK_Date.cpp.

◆ ModifyDate()

bool HK_Date::ModifyDate ( int  Days,
bool  Operator 
)

Adds Or Subtracts Days From This HK_Date.

Parameters
Operatortrue == Add, false == Subtract
See also
AddDays()
SubtractDays()
Returns
True If Resulting Date Is Valid

Definition at line 207 of file HK_Date.cpp.

◆ MonthName()

std::string HK_Date::MonthName ( )

Returns HK_Month's Name As String.

Definition at line 188 of file HK_Date.cpp.

◆ MonthToInt()

int HK_Date::MonthToInt ( std::string  Month)

Converts Month Name To An Int.

Returns
-1 On Error

Definition at line 175 of file HK_Date.cpp.

◆ Reset()

void HK_Date::Reset ( )

Resets Date To Today.

Definition at line 400 of file HK_Date.cpp.

◆ SetDate() [1/2]

bool HK_Date::SetDate ( int  Days,
int  Month,
int  Year 
)

Sets Day, Month, and Year.

Returns
True If Date Is Valid.

Definition at line 32 of file HK_Date.cpp.

◆ SetDate() [2/2]

bool HK_Date::SetDate ( std::string  Date)

Sets Day, Month, and Year From A Year/Month/Day String.

Returns
True If Date Is Valid.
Todo:
catch exception

Definition at line 40 of file HK_Date.cpp.

◆ SetDay()

void HK_Date::SetDay ( int  Days)

Sets Day Value, Doesn't Check If Its Valid.

Definition at line 48 of file HK_Date.cpp.

◆ SetMonth()

void HK_Date::SetMonth ( int  Month)

Sets Month Value, Doesn't Check If Its Valid.

Definition at line 51 of file HK_Date.cpp.

◆ SetYear()

void HK_Date::SetYear ( int  Year)

Sets Year Value, Doesn't Check If Its Valid.

Definition at line 54 of file HK_Date.cpp.

◆ SplitStrings()

std::vector< std::string > HK_Date::SplitStrings ( std::string  In,
std::string  Split 
)

Splits In By Split And Returns A Vector With Data.

Definition at line 444 of file HK_Date.cpp.

◆ StartDayOfWeek()

int HK_Date::StartDayOfWeek ( )

Returns What Day Of The Week This HK_Date Month Starts.

Definition at line 411 of file HK_Date.cpp.

◆ SubtractDays()

bool HK_Date::SubtractDays ( int  Days)

Subtracts Days To This HK_Date.

Returns
True If Resulting Date Is Valid.
See also
ModifyDate()
AddDays()

Definition at line 79 of file HK_Date.cpp.

◆ ToReadable()

std::string HK_Date::ToReadable ( std::string  Separator,
int  Mode 
)

Generate A Readable String.

Parameters
Separatori.e. "/" day/month/year
Mode
Returns
This HK_Date As A String

Definition at line 132 of file HK_Date.cpp.

◆ ToSortable()

std::string HK_Date::ToSortable ( std::string  Separator)

Generate A Sortable String For Database.

Parameters
Separatori.e. "/" Year/Month/Day
Returns
This HK_Date As A String In Year/Month/Day format

Definition at line 163 of file HK_Date.cpp.

Member Data Documentation

◆ HK_Day

int HK_Date::HK_Day
private

Holds The Day Part Of The Date.

Definition at line 28 of file Date.h.

◆ HK_Month

int HK_Date::HK_Month
private

Holds The Month Part Of The Date.

Definition at line 29 of file Date.h.

◆ HK_Year

int HK_Date::HK_Year
private

Holds The Year Part Of The Date.

Definition at line 30 of file Date.h.


The documentation for this class was generated from the following files: