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 OFDATIME_H
00035 #define OFDATIME_H
00036
00037 #include "dcmtk/config/osconfig.h"
00038
00039 #include "dcmtk/ofstd/ofstring.h"
00040 #include "dcmtk/ofstd/ofdate.h"
00041 #include "dcmtk/ofstd/oftime.h"
00042
00043
00044
00045
00046
00047
00050 class OFDateTime
00051 {
00052
00053 public:
00054
00058 OFDateTime();
00059
00063 OFDateTime(const OFDateTime &dateTime);
00064
00069 OFDateTime(const OFDate &dateVal,
00070 const OFTime &timeVal);
00071
00074 virtual ~OFDateTime();
00075
00080 virtual OFDateTime &operator=(const OFDateTime &dateTime);
00081
00089 virtual OFBool operator==(const OFDateTime &dateTime) const;
00090
00098 virtual OFBool operator!=(const OFDateTime &dateTime) const;
00099
00103 virtual void clear();
00104
00109 virtual OFBool isValid() const;
00110
00122 OFBool setDateTime(const unsigned int year,
00123 const unsigned int month,
00124 const unsigned int day,
00125 const unsigned int hour,
00126 const unsigned int minute,
00127 const double second,
00128 const double timeZone = 0);
00129
00135 OFBool setDate(const OFDate &dateVal);
00136
00142 OFBool setTime(const OFTime &timeVal);
00143
00149 OFBool setCurrentDateTime();
00150
00159 OFBool setISOFormattedDateTime(const OFString &formattedDateTime);
00160
00164 const OFDate &getDate() const;
00165
00169 const OFTime &getTime() const;
00170
00186 OFBool getISOFormattedDateTime(OFString &formattedDateTime,
00187 const OFBool showSeconds = OFTrue,
00188 const OFBool showFraction = OFFalse,
00189 const OFBool showTimeZone = OFFalse,
00190 const OFBool showDelimiter = OFTrue) const;
00191
00208 OFBool getISOFormattedDateTime(OFString &formattedDateTime,
00209 const OFBool showSeconds ,
00210 const OFBool showFraction ,
00211 const OFBool showTimeZone ,
00212 const OFBool showDelimiter ,
00213 const OFString &dateTimeSeparator ) const;
00214
00215
00216
00220 static OFDateTime getCurrentDateTime();
00221
00222
00223 private:
00224
00226 OFDate Date;
00227
00229 OFTime Time;
00230 };
00231
00232
00239 ostream& operator<<(ostream& stream, const OFDateTime &dateTime);
00240
00241
00242 #endif
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274