00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
#ifndef OFDATE_H
00035
#define OFDATE_H
00036
00037
#include "osconfig.h"
00038
00039 BEGIN_EXTERN_C
00040
#ifdef HAVE_SYS_TYPES_H
00041
# include <sys/types.h>
00042
#endif
00043
END_EXTERN_C
00044
00045
#include "ofstring.h"
00046
#include "ofstream.h"
00047
00048
00049
00050
00051
00052
00055 class OFDate
00056 {
00057
00058
friend class OFDateTime;
00059
00060
00061
public:
00062
00066
OFDate();
00067
00071
OFDate(
const OFDate &dateVal);
00072
00078
OFDate(
const unsigned int year,
00079
const unsigned int month,
00080
const unsigned int day);
00081
00084
virtual ~OFDate();
00085
00090
virtual OFDate &
operator=(
const OFDate &dateVal);
00091
00096
virtual OFBool
operator==(
const OFDate &dateVal)
const;
00097
00102
virtual OFBool
operator!=(
const OFDate &dateVal)
const;
00103
00109
virtual OFBool
operator<(
const OFDate &dateVal)
const;
00110
00116
virtual OFBool
operator<=(
const OFDate &dateVal)
const;
00117
00123
virtual OFBool
operator>=(
const OFDate &dateVal)
const;
00124
00130
virtual OFBool
operator>(
const OFDate &dateVal)
const;
00131
00135
virtual void clear();
00136
00143
virtual OFBool
isValid()
const;
00144
00152 OFBool
setDate(
const unsigned int year,
00153
const unsigned int month,
00154
const unsigned int day);
00155
00161 OFBool
setYear(
const unsigned int year);
00162
00168 OFBool
setMonth(
const unsigned int month);
00169
00175 OFBool
setDay(
const unsigned int day);
00176
00182 OFBool
setCurrentDate();
00183
00190 OFBool
setISOFormattedDate(
const OFString &formattedDate);
00191
00195
unsigned int getYear()
const;
00196
00200
unsigned int getMonth()
const;
00201
00205
unsigned int getDay()
const;
00206
00214 OFBool
getISOFormattedDate(
OFString &formattedDate,
00215
const OFBool showDelimiter = OFTrue)
const;
00216
00217
00218
00222
static OFDate getCurrentDate();
00223
00224
00225
protected:
00226
00233 OFBool
setCurrentDate(
const time_t &tt);
00234
00235
00236
00246
static OFBool
isDateValid(
const unsigned int year,
00247
const unsigned int month,
00248
const unsigned int day);
00249
00250
00251
private:
00252
00254 unsigned int Year;
00255
00257 unsigned int Month;
00258
00260 unsigned int Day;
00261 };
00262
00263
00270 ostream& operator<<(ostream& stream,
const OFDate &dateVal);
00271
00272
00273
#endif
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300