Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Public Member Functions | Static Public Member Functions | Friends | List of all members
hdi::core::Date Class Reference

Allows for acquisition and manipulation of a date (day of year) More...

#include <hdicoreDate.h>

Public Member Functions

 Date ()
 Constructs a Date object with a default value (1970-01-01) More...
 
 Date (const Date &d_)
 Constructs a Date object from another existing Date object. More...
 
 Date (const std::string &date_)
 Constructs a Date object from a string representation of a date. More...
 
 Date (const int16_t year_, const int16_t month_, const int16_t day_)
 Constructs a Date object from a given year, month, and day. More...
 
virtual ~Date ()
 Destructs a Date object. More...
 
virtual Dateoperator= (const Date &rhs_)
 Overloaded assignment operator to copy values from one Date object to another. More...
 
virtual bool operator== (const Date &rhs_) const
 Overloaded equality operator to determine if two Date objects are equal. More...
 
virtual bool operator!= (const Date &rhs_) const
 Overloaded inequality operator to determine if two Date objects differ. More...
 
virtual bool operator< (const Date &rhs_) const
 Overloaded less-than operator to determine if one Date object is earlier in time than the other. More...
 
virtual bool operator<= (const Date &rhs_) const
 Overloaded less-than-or-equal operator to determine if one Date object is earlier in time than, or equal to, the other. More...
 
virtual bool operator> (const Date &rhs_) const
 Overloaded greater-than operator to determine if one Date object is later in time than the other. More...
 
virtual bool operator>= (const Date &rhs_) const
 Overloaded greater-than-or-equal operator to determine if one Date object is later in time than, or equal to, the other. More...
 
virtual Duration operator- (const Date &rhs_) const
 Overloaded subtraction operator to determine the duration between two Date objects. More...
 
virtual Date operator- (const Duration &rhs_) const
 Overloaded substraction operator to determine the resultant date before the target. More...
 
virtual Dateoperator-= (const Duration &rhs_)
 Overloaded subtraction-assignment operator to determine and assign the resultant date before the initial target. More...
 
virtual Date operator+ (const Duration &rhs_) const
 Overloaded addition operator to determine the resultant date after the target. More...
 
virtual Dateoperator+= (const Duration &rhs_)
 Overloaded addition-assignment operator to determine and assign the resultant date after the initial target. More...
 
virtual std::string format (const std::string &format_="Y-m-d") const
 Formats the target Date object into a string representation. More...
 
virtual int16_t year () const
 Gets the year represented by the target. More...
 
virtual void setYear (const int16_t year_)
 Sets the year that the target should represent. More...
 
virtual int16_t month () const
 Gets the month of the year represented by the target. More...
 
virtual void setMonth (const int16_t month_)
 Sets the month of the year represented by the target. More...
 
virtual int16_t day () const
 Gets the day of the month represented by the target. More...
 
virtual void setDay (const int16_t day_)
 Sets the day of the month represented by the target. More...
 
virtual int16_t dayOfWeek () const
 Gets the day number of the week, from 0 to 6. More...
 
virtual int16_t weekNumber () const
 Gets the ISO-8601 week number of the year represented by the target, from 1 to 53. More...
 
virtual int16_t endOfMonth () const
 Gets the last day of the month represented by the target, from 28 to 31. More...
 
virtual int16_t dayOfYear () const
 Gets the day number of the year, from 1 to 366. More...
 

Static Public Member Functions

static Date Current ()
 Constructs a Date object from the current system date. More...
 

Friends

class DateTime
 

Detailed Description

Allows for acquisition and manipulation of a date (day of year)

Constructor & Destructor Documentation

hdi::core::Date::Date ( )

Constructs a Date object with a default value (1970-01-01)

Author
GW
Date
11/2014
hdi::core::Date::Date ( const Date d_)

Constructs a Date object from another existing Date object.

Author
GW
Date
11/2014
Parameters
d_Existing object to copy values from
hdi::core::Date::Date ( const std::string &  date_)

Constructs a Date object from a string representation of a date.

Author
GW
Date
11/2014
Parameters
date_String representation of a date
Note
The expected format is e.g. "2014-11-25". A variety of delimiters can be used (i.e. '-', '.', ' ', '/', and ','). Strings that do not follow this format have the same result as using the Date() ctor.
hdi::core::Date::Date ( const int16_t  year_,
const int16_t  month_,
const int16_t  day_ 
)

Constructs a Date object from a given year, month, and day.

Author
GW
Date
11/2014
Parameters
year_Year, in the range [1970,9999]
month_Month of the given year, in the range [1,12]
day_Day of the month, in the range [1,31]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual hdi::core::Date::~Date ( )
virtual

Destructs a Date object.

Author
GW
Date
11/2014

Member Function Documentation

static Date hdi::core::Date::Current ( )
static

Constructs a Date object from the current system date.

Author
GW
Date
04/2015
Returns
A Date object for the current UTC time
virtual int16_t hdi::core::Date::day ( ) const
virtual

Gets the day of the month represented by the target.

Author
GW
Date
11/2014
Returns
The day of the month
virtual int16_t hdi::core::Date::dayOfWeek ( ) const
virtual

Gets the day number of the week, from 0 to 6.

Author
GW
Date
11/2014
Returns
Numeric representation of the day of the week (0 is Sunday, 1 is Monday, etc.)
virtual int16_t hdi::core::Date::dayOfYear ( ) const
virtual

Gets the day number of the year, from 1 to 366.

Author
GW
Date
11/2014
Returns
Day of the year (rather than day of the month)
virtual int16_t hdi::core::Date::endOfMonth ( ) const
virtual

Gets the last day of the month represented by the target, from 28 to 31.

Author
GW
Date
11/2014
Returns
The last day of the month
virtual std::string hdi::core::Date::format ( const std::string &  format_ = "Y-m-d") const
virtual

Formats the target Date object into a string representation.

Author
GW
Date
11/2014
Parameters
format_Input string representing the format for the output string
Returns
An output string for the target object's date, formatted as indicated
Note
The following characters are supported as part of the format_ argument: "Y" for a full 4-digit numeric representation of a year, "y" for a 2-digit representation of a year, "m" for a numeric representation of a month with leading zeros, "n" for a numeric representation of a month without leading zeros, "M" for a short textual representation of a month in three letters (e.g. Jan, Feb), "F" for a full textual representation of a month (e.g. January, February), "t" for the number of days in the month, "W" for the ISO-8601 week number of year (from 1 to 53, starting on Monday), "d" for a 2-digit representation of the day of the month with leading zeros, "j" for a 2-digit representation of the day of the month without leading zeros, "z" for the day of the year (from 1 to 366), "D" for a short textual representation of a day in three letters (e.g. Mon, Tue), "l" for a full textual representation of the day of the week (e.g. Monday, Tuesday), and "N" for the ISO-8601 numeric representation of the day of the week (1 for Monday, 2 for Tuesday).
The special characters above will be expanded as described, and any other characters will simply be inserted in the output string. A special character can be preceeded by a '\' (backslash) character to prevent expansion (the backslash will not be inserted in the output string). If a backslash character is desired in the output string, preceed it with another backslash character.
virtual int16_t hdi::core::Date::month ( ) const
virtual

Gets the month of the year represented by the target.

Author
GW
Date
11/2014
Returns
The month of the year
virtual bool hdi::core::Date::operator!= ( const Date rhs_) const
virtual

Overloaded inequality operator to determine if two Date objects differ.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator; Date object to compare
Returns
true if the two objects represent different days
virtual Date hdi::core::Date::operator+ ( const Duration rhs_) const
virtual

Overloaded addition operator to determine the resultant date after the target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to add to the lefthand side
Returns
The date that would result from adding the duration to the target
Note
For partial-day durations, the addition behaves as if the time of day is 00:00:00. That is, if adding less than a whole day the new date will remain unchanged, and if subtracting less than a whole day the new date will become the previous day.
virtual Date& hdi::core::Date::operator+= ( const Duration rhs_)
virtual

Overloaded addition-assignment operator to determine and assign the resultant date after the initial target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to add to the lefthand side
Returns
The target Date object, but with its values updated to reflect the addition of the given duration
Note
For partial-day durations, the addition behaves as if the time of day is 00:00:00. That is, if adding less than a whole day the new date will remain unchanged, and if subtracting less than a whole day the new date will become the previous day.
virtual Duration hdi::core::Date::operator- ( const Date rhs_) const
virtual

Overloaded subtraction operator to determine the duration between two Date objects.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Date object to "substract" from the lefthand side
Returns
The duration between the two days
virtual Date hdi::core::Date::operator- ( const Duration rhs_) const
virtual

Overloaded substraction operator to determine the resultant date before the target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to substract from the lefthand side
Returns
The date that would result from subtracting the duration from the target
Note
For partial-day durations, the subtraction behaves as if the time of day is 00:00:00. That is, if subtracting less than a whole day the new date will become the previous day, and if adding less than a whole day the new date will remain unchanged.
virtual Date& hdi::core::Date::operator-= ( const Duration rhs_)
virtual

Overloaded subtraction-assignment operator to determine and assign the resultant date before the initial target.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator, Duration object to substract from the lefthand side
Returns
The target Date object, but with its values updated to reflect the substraction of the given duration
Note
For partial-day durations, the subtraction behaves as if the time of day is 00:00:00. That is, if subtracting less than a whole day the new date will become the previous day, and if adding less than a whole day the new date will remain unchanged.
virtual bool hdi::core::Date::operator< ( const Date rhs_) const
virtual

Overloaded less-than operator to determine if one Date object is earlier in time than the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; Date object that might be later in time than the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a date earlier than rhs_
virtual bool hdi::core::Date::operator<= ( const Date rhs_) const
virtual

Overloaded less-than-or-equal operator to determine if one Date object is earlier in time than, or equal to, the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; Date object that might be later in time than, or equal to, the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a date earlier than, or equal to, rhs_
virtual Date& hdi::core::Date::operator= ( const Date rhs_)
virtual

Overloaded assignment operator to copy values from one Date object to another.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator; Date object to copy values from
Returns
The target Date object, but with values updated to match that of rhs_
virtual bool hdi::core::Date::operator== ( const Date rhs_) const
virtual

Overloaded equality operator to determine if two Date objects are equal.

Author
GW
Date
11/2014
Parameters
rhs_Righthand side of the operator; Date object to compare
Returns
true if the two objects represent the same day
virtual bool hdi::core::Date::operator> ( const Date rhs_) const
virtual

Overloaded greater-than operator to determine if one Date object is later in time than the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; Date object that might be earlier in time than the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a date later than rhs_
virtual bool hdi::core::Date::operator>= ( const Date rhs_) const
virtual

Overloaded greater-than-or-equal operator to determine if one Date object is later in time than, or equal to, the other.

Author
GW
Date
02/2015
Parameters
rhs_Righthand side of the operator; Date object that might be earlier in time than, or equal to, the target (i.e. lefthand side)
Returns
true if the target (i.e. lefthand side) represents a date later than, or equal to, rhs_
virtual void hdi::core::Date::setDay ( const int16_t  day_)
virtual

Sets the day of the month represented by the target.

Author
GW
Date
11/2014
Parameters
day_Day of the month, in range [1,31]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual void hdi::core::Date::setMonth ( const int16_t  month_)
virtual

Sets the month of the year represented by the target.

Author
GW
Date
11/2014
Parameters
month_Month of the year, in range [1,12]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual void hdi::core::Date::setYear ( const int16_t  year_)
virtual

Sets the year that the target should represent.

Author
GW
Date
11/2014
Parameters
year_Year, in range [1970,9999]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual int16_t hdi::core::Date::weekNumber ( ) const
virtual

Gets the ISO-8601 week number of the year represented by the target, from 1 to 53.

Author
GW
Date
11/2014
Returns
Week number in the year of the date
virtual int16_t hdi::core::Date::year ( ) const
virtual

Gets the year represented by the target.

Author
GW
Date
11/2014
Returns
The year number