I've written a header file containing all of my file declarations for a program, but according to my code editor, Atom the #endif guard is not closing properly. The problem seems to be with two non-member operator overloads that are at the end of my .h file, but I feel like everything is where it should be so I'm not sure why the #endif guard is not closing. Here's my code:
Code:
#ifndef SICT_DATE_H__
#define SICT_DATE_H__
//readErrorCode_ definitions
#define NO_ERROR 0 //no error date if valid
#define CIN_FAILED 1 //istream failed when entering information
#define YEAR_ERROR 2 //year value is invalid
#define MON_ERROR 3 //month value is invalid
#define DAY_ERROR 4 //day value is invalid
namespace sict {
class Date {
int year_; //holds year; a four digit int between MIN_YEAR and MAX_YEAR
int mon_; //month of the year, between 1 to 12
int day_; //day of the month, not that a leap year in February is 29 days, (see mday())
int readErrorCode_; //holds an error code with which the caller program can reference
//to find out if the date value is valid and if not, which part is erroneous.
int value() const; //function already implemented
void errCode(int errorCode); //sets the readErrorCode_ member variable to one of
//the values mentioned above
void isValid(); //determine is date values are within range
//Constructors
public:
Date(); //default constructor: sets year_, mon_ and day_ to "0" and readErrorCode_ to NO_ERROR
Date(int year, int month, int day); //three argument constructor: accepts three arguments to set values
//of year_, mon_ and day_ attributes. Also sets readErrorCode_ to NO_ERROR
//comparison logical operator overloads
bool operator==(const Date& D)const;
bool operator!=(const Date& D)const;
bool operator<(const Date& D)const;
bool operator>(const Date& D)const;
bool operator<=(const Date& D)const;
bool operator>=(const Date& D)const;
int mdays(int mon)const; //function is already implemented and provided
//accessor or getter member functions
int errCode()const; //returns readErrorCode_ value
bool bad()const; //returns true if readErrorCode_ is not equal to zero
//IO member functions
std::istream& read(std::istream& istr);//reads date in the following format: YYY?MM?DD
std::ostream& write(std::ostream& ostr)const;
};
//writes the date using ostr argument in the following format
//YYY/MM/DD then return the ostr
std::ostream& operator<<(std::ostream& os, const Date& D);
std::istream& operator>>(std::istream& is, Date& D);
}
#endif