hueplusplus
1.0.0
|
Holds different time representations. More...
#include <hueplusplus/TimePattern.h>
Public Types | |
enum | Type { Type::undefined, Type::absolute, Type::recurring, Type::interval, Type::timer } |
Currently active type. More... | |
Public Member Functions | |
TimePattern () | |
Create empty TimePattern. More... | |
~TimePattern () | |
Destructor for union. More... | |
TimePattern (const AbsoluteVariedTime &absolute) | |
Create TimePattern from AbsoluteVariedTime. More... | |
TimePattern (const RecurringTime &recurring) | |
Create TimePattern from RecurringTime. More... | |
TimePattern (const TimeInterval &interval) | |
Create TimePattern from TimeInterval. More... | |
TimePattern (const Timer &timer) | |
Create TimePattern from Timer. More... | |
TimePattern (const TimePattern &other) | |
Copy constructor for union. More... | |
TimePattern & | operator= (const TimePattern &other) |
Copy assignment for union. More... | |
Type | getType () const |
Get currently active type. More... | |
AbsoluteVariedTime | asAbsolute () const |
Get contained absolute time. More... | |
RecurringTime | asRecurring () const |
Get contained recurring time. More... | |
TimeInterval | asInterval () const |
Get contained time interval. More... | |
Timer | asTimer () const |
Get contained timer. More... | |
std::string | toString () const |
Get formatted string of the contained value as expected by Hue API. More... | |
Static Public Member Functions | |
static TimePattern | parse (const std::string &s) |
Parses TimePattern from formatted string as returned by Hue API. More... | |
Holds different time representations.
Holds either AbsoluteTime, RecurringTime, TimeInterval, Timer or an undefined state. TimePattern is used to specify the occurrance of Schedules.
|
strong |
Currently active type.
Enumerator | |
---|---|
undefined | No active type. |
absolute | Active type is AbsoluteVariedTime. |
recurring | Active type is RecurringTime. |
interval | Active type is TimeInterval. |
timer | Active type is Timer. |
hueplusplus::time::TimePattern::TimePattern | ( | ) |
Create empty TimePattern.
hueplusplus::time::TimePattern::~TimePattern | ( | ) |
Destructor for union.
|
explicit |
Create TimePattern from AbsoluteVariedTime.
|
explicit |
Create TimePattern from RecurringTime.
|
explicit |
Create TimePattern from TimeInterval.
|
explicit |
Create TimePattern from Timer.
hueplusplus::time::TimePattern::TimePattern | ( | const TimePattern & | other | ) |
Copy constructor for union.
AbsoluteVariedTime hueplusplus::time::TimePattern::asAbsolute | ( | ) | const |
Get contained absolute time.
TimeInterval hueplusplus::time::TimePattern::asInterval | ( | ) | const |
Get contained time interval.
RecurringTime hueplusplus::time::TimePattern::asRecurring | ( | ) | const |
Get contained recurring time.
Timer hueplusplus::time::TimePattern::asTimer | ( | ) | const |
Get contained timer.
TimePattern::Type hueplusplus::time::TimePattern::getType | ( | ) | const |
Get currently active type.
TimePattern & hueplusplus::time::TimePattern::operator= | ( | const TimePattern & | other | ) |
Copy assignment for union.
|
static |
Parses TimePattern from formatted string as returned by Hue API.
s | Empty string, "none", or in one of the formats the contained types return in their toString() method. |
s
HueException | when the format does not match or a parsing error occurs |
std::invalid_argument | when an integer conversion fails |
std::string hueplusplus::time::TimePattern::toString | ( | ) | const |
Get formatted string of the contained value as expected by Hue API.
AbsoluteVariedTime hueplusplus::time::TimePattern::absolute |
TimeInterval hueplusplus::time::TimePattern::interval |
RecurringTime hueplusplus::time::TimePattern::recurring |
Timer hueplusplus::time::TimePattern::timer |
std::nullptr_t hueplusplus::time::TimePattern::undefined |