00001 /* 00002 * 00003 * Copyright (C) 2002-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: ofstd 00019 * 00020 * Author: Joerg Riesmeier 00021 * 00022 * Purpose: Combined class for date and time functions 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:05:55 $ 00026 * CVS/RCS Revision: $Revision: 1.7 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 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" /* for class OFString */ 00040 #include "dcmtk/ofstd/ofdate.h" /* for class OFDate */ 00041 #include "dcmtk/ofstd/oftime.h" /* for class OFTime */ 00042 00043 00044 /*---------------------* 00045 * class declaration * 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 /*= OFTrue*/, 00210 const OFBool showFraction /*= OFFalse*/, 00211 const OFBool showTimeZone /*= OFFalse*/, 00212 const OFBool showDelimiter /*= OFTrue*/, 00213 const OFString &dateTimeSeparator /*= " "*/) const; 00214 00215 /* --- static helper functions --- */ 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 * CVS/RCS Log: 00248 * $Log: ofdatime.h,v $ 00249 * Revision 1.7 2005/12/08 16:05:55 meichel 00250 * Changed include path schema for all DCMTK header files 00251 * 00252 * Revision 1.6 2004/04/16 12:43:26 joergr 00253 * Restructured code to avoid default parameter values for "complex types" like 00254 * OFString. Required for Sun CC 2.0.1. 00255 * 00256 * Revision 1.5 2004/01/16 10:30:39 joergr 00257 * Added setISOFormattedXXX() methods for Date, Time and DateTime. 00258 * 00259 * Revision 1.4 2003/12/17 15:16:20 joergr 00260 * Added note to the comparison operators that the "day overflow" is not yet 00261 * handled correctly. 00262 * 00263 * Revision 1.3 2003/09/15 12:12:56 joergr 00264 * Fixed incorrect/improper comments of the comparision operators. Enhanced 00265 * comment of the default constructor. Made comparison operators const. 00266 * 00267 * Revision 1.2 2002/05/24 09:43:04 joergr 00268 * Renamed some parameters/variables to avoid ambiguities. 00269 * 00270 * Revision 1.1 2002/04/11 12:12:23 joergr 00271 * Introduced new standard classes providing date and time functions. 00272 * 00273 * 00274 */