OFFIS DCMTK  Version 3.6.0
ofdate.h
1 /*
2  *
3  * Copyright (C) 2002-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: ofstd
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose: Class for date functions
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:15:50 $
22  * CVS/RCS Revision: $Revision: 1.9 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef OFDATE_H
31 #define OFDATE_H
32 
33 #include "dcmtk/config/osconfig.h"
34 
35 BEGIN_EXTERN_C
36 #ifdef HAVE_SYS_TYPES_H
37 # include <sys/types.h> /* for struct time_t */
38 #endif
39 END_EXTERN_C
40 
41 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */
42 #include "dcmtk/ofstd/ofstream.h" /* for ostream */
43 
44 
45 /*---------------------*
46  * class declaration *
47  *---------------------*/
48 
51 class OFDate
52 {
53  // allow class OFDateTime to access protected class members
54  friend class OFDateTime;
55 
56 
57  public:
58 
62  OFDate();
63 
67  OFDate(const OFDate &dateVal);
68 
74  OFDate(const unsigned int year,
75  const unsigned int month,
76  const unsigned int day);
77 
80  virtual ~OFDate();
81 
86  virtual OFDate &operator=(const OFDate &dateVal);
87 
92  virtual OFBool operator==(const OFDate &dateVal) const;
93 
98  virtual OFBool operator!=(const OFDate &dateVal) const;
99 
105  virtual OFBool operator<(const OFDate &dateVal) const;
106 
112  virtual OFBool operator<=(const OFDate &dateVal) const;
113 
119  virtual OFBool operator>=(const OFDate &dateVal) const;
120 
126  virtual OFBool operator>(const OFDate &dateVal) const;
127 
131  virtual void clear();
132 
139  virtual OFBool isValid() const;
140 
148  OFBool setDate(const unsigned int year,
149  const unsigned int month,
150  const unsigned int day);
151 
157  OFBool setYear(const unsigned int year);
158 
164  OFBool setMonth(const unsigned int month);
165 
171  OFBool setDay(const unsigned int day);
172 
178  OFBool setCurrentDate();
179 
186  OFBool setISOFormattedDate(const OFString &formattedDate);
187 
191  unsigned int getYear() const;
192 
196  unsigned int getMonth() const;
197 
201  unsigned int getDay() const;
202 
210  OFBool getISOFormattedDate(OFString &formattedDate,
211  const OFBool showDelimiter = OFTrue) const;
212 
213  /* --- static helper functions --- */
214 
218  static OFDate getCurrentDate();
219 
220 
221  protected:
222 
229  OFBool setCurrentDate(const time_t &tt);
230 
231  /* --- static helper functions --- */
232 
242  static OFBool isDateValid(const unsigned int year,
243  const unsigned int month,
244  const unsigned int day);
245 
246 
247  private:
248 
250  unsigned int Year;
251 
253  unsigned int Month;
254 
256  unsigned int Day;
257 };
258 
259 
266 STD_NAMESPACE ostream& operator<<(STD_NAMESPACE ostream& stream, const OFDate &dateVal);
267 
268 
269 #endif
270 
271 
272 /*
273  *
274  * CVS/RCS Log:
275  * $Log: ofdate.h,v $
276  * Revision 1.9 2010-10-14 13:15:50 joergr
277  * Updated copyright header. Added reference to COPYRIGHT file.
278  *
279  * Revision 1.8 2006/08/14 16:42:26 meichel
280  * Updated all code in module ofstd to correctly compile if the standard
281  * namespace has not included into the global one with a "using" directive.
282  *
283  * Revision 1.7 2005/12/08 16:05:54 meichel
284  * Changed include path schema for all DCMTK header files
285  *
286  * Revision 1.6 2004/01/16 10:30:39 joergr
287  * Added setISOFormattedXXX() methods for Date, Time and DateTime.
288  *
289  * Revision 1.5 2003/09/15 12:12:56 joergr
290  * Fixed incorrect/improper comments of the comparision operators. Enhanced
291  * comment of the default constructor. Made comparison operators const.
292  *
293  * Revision 1.4 2003/07/04 13:30:37 meichel
294  * Added include for ofstream.h, to make sure ofstream is correctly defined
295  *
296  * Revision 1.3 2002/05/24 09:43:04 joergr
297  * Renamed some parameters/variables to avoid ambiguities.
298  *
299  * Revision 1.2 2002/04/15 09:38:58 joergr
300  * Added "include <sys/types.h>" for struct time_t (required for MSVC).
301  *
302  * Revision 1.1 2002/04/11 12:12:23 joergr
303  * Introduced new standard classes providing date and time functions.
304  *
305  *
306  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2