Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / Date / Date.h
blob: aa4047d50ae9c81d261980b539f75a4759bf5474 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef HEADER_DATETIME
#define HEADER_DATETIME

#include <istream>
#include <ostream>

class Date {
	unsigned short day;
	unsigned short month;
	unsigned short year;

	bool isLeapYear();
	unsigned short daysInMonth();

public:
	Date();
	Date(unsigned short day, unsigned short month, unsigned short year);

	unsigned short get_day() const;
	unsigned short get_month() const;
	unsigned short get_year() const;

	void read(std::istream& istr);
	void write(std::ostream& ostr);
	int compare(const Date& other) const;
};

std::istream& operator>>(std::istream& istr, Date& dt);
std::ostream& operator<<(std::ostream& ostr, const Date& dt);

#endif