Timetabler
Public Member Functions | List of all members
Time Class Reference

Class for a time unit. More...

#include <slot.h>

Public Member Functions

 Time (unsigned, unsigned)
 Constructs the Time object. More...
 
 Time (std::string)
 Constructs the Time object. More...
 
Timeoperator= (const Time &)
 Assigns a time object to this. More...
 
bool operator== (const Time &)
 Checks if two Time objects are identical, which is whether they represent the same hours and minutes. More...
 
bool operator< (const Time &)
 Checks if a Time is strictly before another. More...
 
bool operator<= (const Time &)
 Checks if a Time is before or identical to another. More...
 
bool operator>= (const Time &)
 Checks if a Time is after or identical to another. More...
 
bool operator> (const Time &)
 Checks if a Time is strictly after another. More...
 
std::string getTimeString ()
 Gets the time as a string. More...
 
bool isMorningTime ()
 Determines if the Time is a morning time. More...
 

Detailed Description

Class for a time unit.

This can represent the hours and minutes as a time unit.

Constructor & Destructor Documentation

Time::Time ( unsigned  hours,
unsigned  minutes 
)

Constructs the Time object.

Parameters
[in]hoursThe hours
[in]minutesThe minutes
Time::Time ( std::string  time)

Constructs the Time object.

Parameters
[in]timeThe time represented as a string in the 24 hour format. A valid input would be "12:30".

Member Function Documentation

std::string Time::getTimeString ( )

Gets the time as a string.

For example, 10 hours and 30 minutes is represented as "10:30".

Returns
The time string.
bool Time::isMorningTime ( )

Determines if the Time is a morning time.

A Time is said to be a morning time if its hours value lies in the range [0,12].

Returns
True if morning time, False otherwise.
bool Time::operator< ( const Time other)

Checks if a Time is strictly before another.

Parameters
[in]otherThe Time object with which the comparison is being made
Returns
True if the Time of this object is strictly before the other object, and False otherwise
bool Time::operator<= ( const Time other)

Checks if a Time is before or identical to another.

Parameters
[in]otherThe Time object with which the comparison is being made
Returns
True if this is before or identical to the other object, False otherwise
Time & Time::operator= ( const Time other)

Assigns a time object to this.

Parameters
[in]otherThe object that is assigned
Returns
this Time object
bool Time::operator== ( const Time other)

Checks if two Time objects are identical, which is whether they represent the same hours and minutes.

Parameters
[in]otherThe Time object with which the comparison is being made
Returns
True if identical, False otherwise
bool Time::operator> ( const Time other)

Checks if a Time is strictly after another.

Parameters
[in]otherThe Time object with which the comparison is being made
Returns
True if the Time of this object is strictly after the other object, and False otherwise
bool Time::operator>= ( const Time other)

Checks if a Time is after or identical to another.

Parameters
[in]otherThe Time object with which the comparison is being made
Returns
True if this is after or identical to the other object, False otherwise

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