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::Time Class Reference

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

#include <hdicoreTime.h>

Public Member Functions

 Time ()
 Constructs a Time object with a default value (midnight, 0:00) More...
 
 Time (const Time &t_)
 Constructs a Time object from another existing Time object. More...
 
 Time (const int32_t secsSinceMN_)
 Constructs a Time object with an offset from midnight in seconds. More...
 
 Time (const double secsSinceMN_)
 Constructs a Time object with an offset from midnight in seconds. More...
 
 Time (const std::string &time_)
 Constructs a Time object from a string representation of time. More...
 
 Time (const int16_t hour_, const int16_t min_, const int16_t sec_=0, const int32_t us_=0)
 Constructs a Time object from a given hour, minute, second, and microsecond. More...
 
virtual ~Time ()
 Destructs a Time object. More...
 
virtual Timeoperator= (const Time &rhs_)
 Overloaded assignment operator to copy values from one Time object to another. More...
 
virtual bool operator== (const Time &rhs_) const
 Overloaded equality operator to determine if two Time objects are equal. More...
 
virtual bool operator!= (const Time &rhs_) const
 Overloaded inequality operator to determine if two Time objects differ. More...
 
virtual bool operator< (const Time &rhs_) const
 Overloaded less-than operator to determine if one Time object is earlier in the day than the other. More...
 
virtual bool operator<= (const Time &rhs_) const
 Overloaded less-than-or-equal operator to determine if one Time object is earlier in the day than, or equal to, the other. More...
 
virtual bool operator> (const Time &rhs_) const
 Overloaded greater-than operator to determine if one Time object is later in the day than the other. More...
 
virtual bool operator>= (const Time &rhs_) const
 Overloaded greater-than-or-equal operator to determine if one Time object is later in the day than, or equal to, the other. More...
 
virtual Duration operator- (const Time &rhs_) const
 Overloaded subtraction operator to determine the duration between two Time objects. More...
 
virtual Time operator- (const Duration &rhs_) const
 Overloaded substraction operator to determine the resultant time before the target. More...
 
virtual Timeoperator-= (const Duration &rhs_)
 Overloaded subtraction-assignment operator to determine and assign the resultant time before the initial target. More...
 
virtual Time operator+ (const Duration &rhs_) const
 Overloaded addition operator to determine the resultant time after the target. More...
 
virtual Timeoperator+= (const Duration &rhs_)
 Overloaded addition-assignment operator to determine and assign the resultant time after the initial target. More...
 
virtual std::string format (const std::string &format_="H:i:s") const
 Formats the target Time object into a string representation. More...
 
virtual int16_t hour () const
 Gets the hour represented by the target. More...
 
virtual void setHour (const int16_t hour_)
 Sets the hour that the target should represent. More...
 
virtual int16_t minute () const
 Gets the minute of the hour represented by the target. More...
 
virtual void setMinute (const int16_t min_)
 Sets the minute of the hour represented by the target. More...
 
virtual int16_t second () const
 Gets the second of the minute represented by the target. More...
 
virtual void setSecond (const int16_t sec_)
 Sets the second of the minute represented by the target. More...
 
virtual int32_t microsecond () const
 Gets the microsecond of the second represented by the target. More...
 
virtual void setMicrosecond (const int32_t us_)
 Sets the microsecond of the second represented by the target. More...
 
virtual double secondsSinceMidnight () const
 Gets the number of seconds, since midnight, represented by the target. More...
 
virtual void setSecondsSinceMidnight (const double secsSinceMN_)
 Sets the number of seconds, since midnight, represented by the target. More...
 

Static Public Member Functions

static Time Current (const bool us_=false)
 Constructs a Time object from the current system time. More...
 

Friends

class DateTime
 

Detailed Description

Allows for acquisition and manipulation of a time (of day)

Constructor & Destructor Documentation

hdi::core::Time::Time ( )

Constructs a Time object with a default value (midnight, 0:00)

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

Constructs a Time object from another existing Time object.

Author
GW
Date
11/2014
Parameters
t_Existing object to copy values from
hdi::core::Time::Time ( const int32_t  secsSinceMN_)
explicit

Constructs a Time object with an offset from midnight in seconds.

Author
GW
Date
11/2014
Parameters
secsSinceMN_Number of seconds since midnight, in the range [0,86400]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
hdi::core::Time::Time ( const double  secsSinceMN_)
explicit

Constructs a Time object with an offset from midnight in seconds.

Author
GW
Date
11/2014
Parameters
secsSinceMN_Number of seconds since midnight, in the range [0.0,86400.0]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
hdi::core::Time::Time ( const std::string &  time_)

Constructs a Time object from a string representation of time.

Author
GW
Date
11/2014
Parameters
time_String representation of a time of day, in 24-hour format
Note
The expected format is e.g. "14:34:56.789". The hours must be in 24-hour format, and a variety of delimeters can be used (i.e. ':', '-', '.', and ','). Strings that do not follow this format have the same result as using the Time() ctor.
hdi::core::Time::Time ( const int16_t  hour_,
const int16_t  min_,
const int16_t  sec_ = 0,
const int32_t  us_ = 0 
)

Constructs a Time object from a given hour, minute, second, and microsecond.

Author
GW
Date
11/2014
Parameters
hour_Hour of the day, in the range [0,23]
min_Minute of the given hour, in the range [0,59]
sec_Second of the given minute, in the range [0,59]
us_Microsecond of the given second, in the range [0,999999]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual hdi::core::Time::~Time ( )
virtual

Destructs a Time object.

Author
GW
Date
11/2014

Member Function Documentation

static Time hdi::core::Time::Current ( const bool  us_ = false)
static

Constructs a Time object from the current system time.

Author
GW
Date
04/2015
Parameters
us_Whether to use microsecond resolution
Returns
A Time object for the current UTC time
virtual std::string hdi::core::Time::format ( const std::string &  format_ = "H:i:s") const
virtual

Formats the target Time 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 time of day, formatted as indicated
Note
The following characters are supported as part of the format_ argument: "H" for 24-hour format of an hour with leading zeros, "h" for 12-hour format of an hour with leading zeros, "G" for 24-hour format of an hour without leading zeros, "g" for 12-hour format of an hour without leading zeros, "i" for minutes with leading zeros, "s" for seconds with leading zeros, "u" for microseconds, "a" for lowercase Ante meridiem and Post meridiem, and "A" for uppercase Ante meridiem and Post meridiem.
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::Time::hour ( ) const
virtual

Gets the hour represented by the target.

Author
GW
Date
11/2014
Returns
The hour, in 24-hour format
virtual int32_t hdi::core::Time::microsecond ( ) const
virtual

Gets the microsecond of the second represented by the target.

Author
GW
Date
11/2014
Returns
The microsecond of the second
virtual int16_t hdi::core::Time::minute ( ) const
virtual

Gets the minute of the hour represented by the target.

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

Overloaded inequality operator to determine if two Time objects differ.

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

Overloaded addition operator to determine the resultant time 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 time of day that would result from adding the duration to the target
virtual Time& hdi::core::Time::operator+= ( const Duration rhs_)
virtual

Overloaded addition-assignment operator to determine and assign the resultant time 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 Time object, but with its values updated to reflect the addition of the given duration
virtual Duration hdi::core::Time::operator- ( const Time rhs_) const
virtual

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

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

Overloaded substraction operator to determine the resultant time 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 time of day that would result from subtracting the duration from the target
virtual Time& hdi::core::Time::operator-= ( const Duration rhs_)
virtual

Overloaded subtraction-assignment operator to determine and assign the resultant time 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 Time object, but with its values updated to reflect the substraction of the given duration
virtual bool hdi::core::Time::operator< ( const Time rhs_) const
virtual

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

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

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

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

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

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

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

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

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

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

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

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

Gets the second of the minute represented by the target.

Author
GW
Date
11/2014
Returns
The second of the minute
virtual double hdi::core::Time::secondsSinceMidnight ( ) const
virtual

Gets the number of seconds, since midnight, represented by the target.

Author
GW
Date
11/2014
Returns
The number of seconds since midnight
virtual void hdi::core::Time::setHour ( const int16_t  hour_)
virtual

Sets the hour that the target should represent.

Author
GW
Date
11/2014
Parameters
hour_Hour of day, in 24-hour format, in range [0,23]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual void hdi::core::Time::setMicrosecond ( const int32_t  us_)
virtual

Sets the microsecond of the second represented by the target.

Author
GW
Date
11/2014
Parameters
us_Microsecond of the second, in range [0,999999]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual void hdi::core::Time::setMinute ( const int16_t  min_)
virtual

Sets the minute of the hour represented by the target.

Author
GW
Date
11/2014
Parameters
min_Minute of the hour, in range [0,59]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual void hdi::core::Time::setSecond ( const int16_t  sec_)
virtual

Sets the second of the minute represented by the target.

Author
GW
Date
11/2014
Parameters
sec_Second of the minute, in range [0,59]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.
virtual void hdi::core::Time::setSecondsSinceMidnight ( const double  secsSinceMN_)
virtual

Sets the number of seconds, since midnight, represented by the target.

Author
GW
Date
11/2014
Parameters
secsSinceMN_Seconds since midnight, in range [0.0,86400.0]
Note
Values below or above the expected range will be forced to the minimum or maximum value, respectively.