3.3.2 Date::WeekDay

The Date::WeekDay nested class is provided for day of week handling. It defines the week day constants, and it can convert week days from and into various formats.

As of this release locales are not implemented. This means only english named days are accepted for conversions to or from strings.


Synopsis


  #include <lyric/Date.hpp>
  
  class Date::WeekDay
  {
  public:
    enum Val { Sunday, Monday, Tuesday, Wednesday,
               Thursday, Friday, Saturday };
    ~Date::WeekDay ();
    Date::WeekDay (Val val);
    Date::WeekDay (uint8 intval);
    Date::WeekDay (const Date::WeekDay& day);
    Date::WeekDay& operator = (const Date::WeekDay& day);
    operator uint8 () const;
    Date::WeekDay& operator << (const String& strday);
  
  friend:
    Date::String& operator << (Date::String& out,
                               const Date::WeekDay& day);
  };


Description


˜Date::WeekDay ()
Destroys this week day, releasing eventually used memory resources.

Date::WeekDay (Week::Day::Val val)
Constructs this week day with the given val. The given val is one of the week day constants from the nested enumerate Date::WeekDay::Val.

Date::WeekDay (uint8 intval)
Constructs this week day from the given integer intval. The given intval is the numeric representation of the week day, with Sunday = 0, ..., Saturday = 6. Actually the given intval can take any integer value (which fits in a byte), since the modulo of intval is used for the construction.

Date::WeekDay (const Date::WeekDay& day)
Constructs this week day from the given week day.

Date::WeekDay& operator = (Date::WeekDay& day)
Assigns this week day from the given week day, and return a reference to this for assignment chaining.

operator int8 () const
Returns the numeric representation of this week day, with Sunday = 0, ..., Saturday = 6. This operator is provided for use of the Date::WeekDay in switch code.

Date::WeekDay& operator << (const String& strday)
Assigns this week day from the rvalue week day given as a String. Table 3.4 gives the list of valid strday rvalues that can be given and to what they are translated.



String (long)String (short)Value



"Sunday" "Sun" Date::WeekDay::Sunday
"Monday" "Mon" Date::WeekDay::Monday
"Tuesday" "Tue" Date::WeekDay::Tuesday
"Wednesday" "Wed" Date::WeekDay::Wednesday
"Thursday" "Thu" Date::WeekDay::Thursday
"Friday" "Fri" Date::Weekday::Friday
"Saturday" "Sat" Date::WeekDay::Saturday




Table 3.4: Week day string to value correspondance list.