Professional Documents
Culture Documents
lasse Date
Programme
hque
1 Prsentation
Le but de
e T.P. est de fournir la
lasse de gestion des dates qui est adapte
au programme
hque. Nous devons don
nous
onformer un interfa
e demand par le programme. L'Api de la
lasse est d
rit en dtail dans le do
ument
en ligne http ://www.iut-lannion.fr/ZONZON/TP/
heque/html/, l'interfa
e est
rsum par l'en-tte date.hh qui vous est fournie page 2.
3 Date
ourante.
Pour
onnatre la date
ourante, il sut d'appeler les fon
tions time et
lo
altime fournies par la bibliothque systme de gestion des dates. Vous trouverez la do
umentation sur
es fon
tions en
onsultant sous ema
s le
hier info
de la bibliothque lib
, au
hapitre Date and Time.
Mar Zonzon
Revision : 1.2
TP: COO
lasse Date
Revision : 1.2
lass Date {
publi
:
3
stru
t BadDate{};
4
stru
t BadFormat{};
5
stru
t OutputRange{};
6
stru
t now{};
7
stati
onst int
enturyLim=50;
8
stati
onst int lwYear = 1970;
9
stati
onst int hiYear = 2035;
10
enum DateFmt {
11
ameri
an,
12
european,
13
iso
14
};
15
enum YearDigits {
16
full,
17
abridged
18
};
19
stati
onst DateFmt defaultFmt;
20
Date( int y, int yday) throw ( BadDate);
21
Date(now);
22
Date( int y, int m, int d )throw ( BadDate );
23
Date(
onst Date &);
24
expli
it Date( std::string s, DateFmt fmt=defaultFmt) throw ( BadFormat, BadDate) ;
25
int year()
onst;
26
int month()
onst;
27
int day()
onst;
28
int yDay()
onst;
29
std::string strDate (YearDigits ydigits=full, DateFmt fmt=defaultFmt )
onst;
30
std::ostream & put (std::ostream& os, YearDigits ydigits=full, DateFmt fmt=defaultFmt)
31
std::ostream & put (std::ostream& os, DateFmt fmt)
onst;
32
std::istream & get(std::istream& is, DateFmt fmt=defaultFmt) throw (BadDate);
33
bool operator==(
onst Date & )
onst;
34
bool operator!=(
onst Date & )
onst;
35
bool operator<(
onst Date & )
onst;
36
bool operator>(
onst Date & )
onst;
37
bool operator<=(
onst Date & )
onst;
38
bool operator>=(
onst Date & )
onst;
39
Date& operator = (
onst Date& d);
40
Date &operator++();
41
Date operator++( int );
42
bool leapYear( )
onst;
43 private:
44
int yearM;
45
int monthM;
46
int dayM;
47 };
48 std::ostream& operator<<( std::ostream &,
onst Date & );
1
Fig.
Mar Zonzon
2004-01-01