/* This file contains the interface for struct Day.
   
-----------------------------------------------------------------*/

#include <iostream.h>

#include "Boolean.h"

#ifndef DAY
#define DAY

enum DayName {DayUnderflow = -1,                 // too-low error
              Sunday, Monday, Tuesday, Wednesday,// 0-3
              Thursday, Friday, Saturday,        // 4-6
              NumberOfDays,                      // 7
              DayOverflow = 7};                  // too-high error

struct Day
{
// -- the public section --

/********** member functions **********/
   /*----- Class constructor -----
      To initialize a declaration of a Day object.

      Receive:  DayName value InitDay (default value of Sunday)
      Return:   this Day object with its data member initialized
                to InitDay
   ----------------------------------------------------------------*/

   Day(DayName InitDay = Sunday) {DayValue_ = InitDay;}

   /*----- Data member extractor ----- . . . */
   DayName DayValue(void) const {return DayValue_;}

   /*----- Assignment ----- . . . */
   Day& operator=(const Day& DayExp);

   /*----- In-/De-crement -----
      Operations that (destructively) increment/decrement
      a Day object . . . */

   Day operator++(void);                     // prefix increment
   Day operator++(int);                      // postfix increment
   Day operator--(int);                      // prefix decrement
   Day operator--(void);                     // postfix decrement

   /*----- Suc-/Prede-cessor -----
      Functions that find the successor/predecessor of
      a Day object . . . */

   Day Next(void) const;                      // next day (wraps)
   Day Previous(void) const;                  // previous day (wraps)

   /*----- Relational Operators ----- . . . */

   friend Boolean operator==(                 // equality
                             const Day& LeftDay,
                             const Day& RightDay);
   friend Boolean operator!=(                 //  inequality
                             const Day& LeftDay,
                             const Day& RightDay);
   friend Boolean operator<(                  //  less than
                             const Day& LeftDay,
                             const Day& RightDay);
   friend Boolean operator<=(                 //  less or equal
                             const Day& LeftDay,
                             const Day& RightDay);
   friend Boolean operator>(                  //  greater than
                             const Day& LeftDay,
                             const Day& RightDay);
   friend Boolean operator>=(                 //  greater or equal
                             const Day& LeftDay,
                             const Day& RightDay);

   /*----- Input/Output ----- . . . */
   /* Interactive */
   friend ostream& operator<< (ostream& Out, const Day& DayIn);
   friend istream& operator>> (istream& In, Day& DayOut);

   /* File */
   friend fstream& operator<< (fstream& Out, const Day& DayIn);
   friend fstream& operator>> (fstream& In, Day& DayOut);

// -- the private section --
 private:

/********** the data member **********/

  DayName
    DayValue_;
};
#endif

