LocalTimeRK
Public Member Functions | Data Fields | Static Public Attributes
LocalTimeDayOfWeek Class Reference

Class for managing a mask value of zero or more days of the week. More...

#include <LocalTimeRK.h>

Public Member Functions

 LocalTimeDayOfWeek ()
 Default constructor with no days of week set.
 
 LocalTimeDayOfWeek (uint8_t mask)
 Sets days of weeks with a bit mask of days. More...
 
LocalTimeDayOfWeekwithWeekdays ()
 Convenience fluent setter to set all weekdays (Monday - Friday) More...
 
LocalTimeDayOfWeekwithWeekends ()
 Convenience fluent setter to set weekend days (Saturday and Sunday) More...
 
LocalTimeDayOfWeekwithAllDays ()
 Convenience fluent setter to set all days. More...
 
bool isSet (int dayOfWeek) const
 Returns true if the specified dayOfWeek is set in the mask. More...
 
bool isSet (LocalTimeYMD ymd) const
 return true if ymd is a day set in this object More...
 
bool isEmpty () const
 Returns true if no days of the week are set in this object. More...
 
uint8_t getMask () const
 Get the current mask value. More...
 
void setMask (uint8_t mask)
 Set the mask value. More...
 
String toString () const
 Converts this object to a human-readable string. More...
 
bool operator== (const LocalTimeDayOfWeek &other) const
 Tests if this object has the same mask as other. More...
 
bool operator!= (const LocalTimeDayOfWeek &other) const
 Tests if this object does not have the same mask as other. More...
 

Data Fields

uint8_t dayOfWeekMask = 0
 Mask value for this object.
 

Static Public Attributes

static const int DAY_SUNDAY = 0
 
static const int DAY_MONDAY = 1
 
static const int DAY_TUESDAY = 2
 
static const int DAY_WEDNESDAY = 3
 
static const int DAY_THURSDAY = 4
 
static const int DAY_FRIDAY = 5
 
static const int DAY_SATURDAY = 6
 
static const uint8_t MASK_SUNDAY = 0x01
 Mask value for Sunday.
 
static const uint8_t MASK_MONDAY = 0x02
 Mask value for Monday.
 
static const uint8_t MASK_TUESDAY = 0x04
 Mask value for Tuesday.
 
static const uint8_t MASK_WEDNESDAY = 0x08
 Mask value for Wednesday.
 
static const uint8_t MASK_THURSDAY = 0x10
 Mask value for Thursday.
 
static const uint8_t MASK_FRIDAY = 0x20
 Mask value for Friday.
 
static const uint8_t MASK_SATURDAY = 0x40
 Mask value for Saturday.
 
static const uint8_t MASK_ALL = MASK_SUNDAY | MASK_MONDAY | MASK_TUESDAY | MASK_WEDNESDAY | MASK_THURSDAY | MASK_FRIDAY | MASK_SATURDAY | MASK_SUNDAY
 Mask value for every day of the week 0x7f = 127.
 
static const uint8_t MASK_WEEKDAY = MASK_MONDAY | MASK_TUESDAY | MASK_WEDNESDAY | MASK_THURSDAY | MASK_FRIDAY
 Mask value for weekdays Monday - Friday 0x3e = 62.
 
static const uint8_t MASK_WEEKEND = MASK_SATURDAY | MASK_SUNDAY
 Mask value for Saturday and Sunday 0x41 = 65.
 

Detailed Description

Class for managing a mask value of zero or more days of the week.

Day 0 = Sunday, 1 = Monday, ..., 6 = Saturday

This class is copyable and assignable and can be tested for equality and inequality

Constructor & Destructor Documentation

◆ LocalTimeDayOfWeek()

LocalTimeDayOfWeek::LocalTimeDayOfWeek ( uint8_t  mask)
inline

Sets days of weeks with a bit mask of days.

Parameters
maskPass values like MASK_SUNDAY, MASK_WEEKDAYS, MASK_WEEKENDS, MASK_ALL, or a custom value

Member Function Documentation

◆ getMask()

uint8_t LocalTimeDayOfWeek::getMask ( ) const
inline

Get the current mask value.

Returns
uint8_t

◆ isEmpty()

bool LocalTimeDayOfWeek::isEmpty ( ) const
inline

Returns true if no days of the week are set in this object.

Returns
true
false

◆ isSet() [1/2]

bool LocalTimeDayOfWeek::isSet ( int  dayOfWeek) const
inline

Returns true if the specified dayOfWeek is set in the mask.

Parameters
dayOfWeekSame as struct tm. 0 < dayOfWeek <= 6. Sunday = 0.
Returns
true
false

◆ isSet() [2/2]

bool LocalTimeDayOfWeek::isSet ( LocalTimeYMD  ymd) const
inline

return true if ymd is a day set in this object

Parameters
ymd
Returns
true
false

◆ operator!=()

bool LocalTimeDayOfWeek::operator!= ( const LocalTimeDayOfWeek other) const
inline

Tests if this object does not have the same mask as other.

Parameters
other
Returns
true
false

◆ operator==()

bool LocalTimeDayOfWeek::operator== ( const LocalTimeDayOfWeek other) const
inline

Tests if this object has the same mask as other.

Parameters
other
Returns
true
false

◆ setMask()

void LocalTimeDayOfWeek::setMask ( uint8_t  mask)
inline

Set the mask value.

Parameters
mask

◆ toString()

String LocalTimeDayOfWeek::toString ( ) const
inline

Converts this object to a human-readable string.

Returns
String

◆ withAllDays()

LocalTimeDayOfWeek & LocalTimeDayOfWeek::withAllDays ( )
inline

Convenience fluent setter to set all days.

Returns
LocalTimeDayOfWeek&

◆ withWeekdays()

LocalTimeDayOfWeek & LocalTimeDayOfWeek::withWeekdays ( )
inline

Convenience fluent setter to set all weekdays (Monday - Friday)

Returns
LocalTimeDayOfWeek&

◆ withWeekends()

LocalTimeDayOfWeek & LocalTimeDayOfWeek::withWeekends ( )
inline

Convenience fluent setter to set weekend days (Saturday and Sunday)

Returns
LocalTimeDayOfWeek&

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