Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/util/doxygen/qtools/qdatetime.h

Source at commit 1406 created 12 years 10 months ago.
By meklort, Revert drivers.c so that kexts are only loaded when OSBundleRequired is set and that value is not safe mode. Added some comments about it too.
1/****************************************************************************
2**
3**
4** Definition of date and time classes
5**
6** Created : 940124
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the tools module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QDATETIME_H
39#define QDATETIME_H
40
41#ifndef QT_H
42#include "qstring.h"
43#endif // QT_H
44
45
46/*****************************************************************************
47 QDate class
48 *****************************************************************************/
49
50class Q_EXPORT QDate
51{
52public:
53 QDate() { jd=0; }// set null date
54 QDate( int y, int m, int d );// set date
55 virtual ~QDate() {}
56
57 bool isNull() const { return jd == 0; }
58 bool isValid() const;// valid date
59
60 int year() const;// 1752..
61 int month() const;// 1..12
62 int day() const;// 1..31
63 int dayOfWeek() const;// 1..7 (monday==1)
64 int dayOfYear() const;// 1..365
65 int daysInMonth() const;// 28..31
66 int daysInYear() const;// 365 or 366
67
68 virtual QString monthName( int month ) const;
69 virtual QString dayName( int weekday ) const;
70
71 QString toString() const;
72
73 bool setYMD( int y, int m, int d );
74
75 QDate addDays( int days )const;
76 int daysTo( const QDate & )const;
77
78 bool operator==( const QDate &d ) const { return jd == d.jd; }
79 bool operator!=( const QDate &d ) const { return jd != d.jd; }
80 bool operator<( const QDate &d )const { return jd < d.jd; }
81 bool operator<=( const QDate &d ) const { return jd <= d.jd; }
82 bool operator>( const QDate &d )const { return jd > d.jd; }
83 bool operator>=( const QDate &d ) const { return jd >= d.jd; }
84
85 static QDate currentDate();
86 static bool isValid( int y, int m, int d );
87 static bool leapYear( int year );
88
89protected:
90 static uint greg2jul( int y, int m, int d );
91 static void jul2greg( uint jd, int &y, int &m, int &d );
92private:
93 static const char * const monthNames[];
94 static const char * const weekdayNames[];
95 uint jd;
96 friend class QDateTime;
97#ifndef QT_NO_DATASTREAM
98 friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QDate & );
99 friend Q_EXPORT QDataStream &operator>>( QDataStream &, QDate & );
100#endif
101};
102
103
104/*****************************************************************************
105 QTime class
106 *****************************************************************************/
107
108class Q_EXPORT QTime
109{
110public:
111 QTime() { ds=0; }// set null time
112 QTime( int h, int m, int s=0, int ms=0 );// set time
113
114 bool isNull() const { return ds == 0; }
115 bool isValid() const;// valid time
116
117 int hour() const;// 0..23
118 int minute() const;// 0..59
119 int second() const;// 0..59
120 int msec() const;// 0..999
121
122 QString toString() const;
123
124 bool setHMS( int h, int m, int s, int ms=0 );
125
126 QTime addSecs( int secs )const;
127 int secsTo( const QTime & )const;
128 QTime addMSecs( int ms )const;
129 int msecsTo( const QTime & )const;
130
131 bool operator==( const QTime &d ) const { return ds == d.ds; }
132 bool operator!=( const QTime &d ) const { return ds != d.ds; }
133 bool operator<( const QTime &d )const { return ds < d.ds; }
134 bool operator<=( const QTime &d ) const { return ds <= d.ds; }
135 bool operator>( const QTime &d )const { return ds > d.ds; }
136 bool operator>=( const QTime &d ) const { return ds >= d.ds; }
137
138 static QTime currentTime();
139 static bool isValid( int h, int m, int s, int ms=0 );
140
141 void start();
142 int restart();
143 int elapsed();
144
145private:
146 static bool currentTime( QTime * );
147
148 uint ds;
149 friend class QDateTime;
150#ifndef QT_NO_DATASTREAM
151 friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QTime & );
152 friend Q_EXPORT QDataStream &operator>>( QDataStream &, QTime & );
153#endif
154};
155
156
157/*****************************************************************************
158 QDateTime class
159 *****************************************************************************/
160
161class Q_EXPORT QDateTime
162{
163public:
164 QDateTime() {}// set null date and null time
165 QDateTime( const QDate & );
166 QDateTime( const QDate &, const QTime & );
167
168 bool isNull()const{ return d.isNull() && t.isNull(); }
169 bool isValid()const{ return d.isValid() && t.isValid(); }
170
171 QDate date()const{ return d; }
172 QTime time()const{ return t; }
173 void setDate( const QDate &date ) { d=date; }
174 void setTime( const QTime &time ) { t=time; }
175 void setTime_t( uint secsSince1Jan1970UTC );
176
177 QString toString()const;
178
179 QDateTime addDays( int days )const;
180 QDateTime addSecs( int secs )const;
181 int daysTo( const QDateTime & )const;
182 int secsTo( const QDateTime & )const;
183
184 bool operator==( const QDateTime &dt ) const;
185 bool operator!=( const QDateTime &dt ) const;
186 bool operator<( const QDateTime &dt ) const;
187 bool operator<=( const QDateTime &dt ) const;
188 bool operator>( const QDateTime &dt ) const;
189 bool operator>=( const QDateTime &dt ) const;
190
191 static QDateTime currentDateTime();
192
193private:
194 QDate d;
195 QTime t;
196#ifndef QT_NO_DATASTREAM
197 friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QDateTime &);
198 friend Q_EXPORT QDataStream &operator>>( QDataStream &, QDateTime & );
199#endif
200};
201
202
203/*****************************************************************************
204 Date and time stream functions
205 *****************************************************************************/
206
207#ifndef QT_NO_DATASTREAM
208Q_EXPORT QDataStream &operator<<( QDataStream &, const QDate & );
209Q_EXPORT QDataStream &operator>>( QDataStream &, QDate & );
210Q_EXPORT QDataStream &operator<<( QDataStream &, const QTime & );
211Q_EXPORT QDataStream &operator>>( QDataStream &, QTime & );
212Q_EXPORT QDataStream &operator<<( QDataStream &, const QDateTime & );
213Q_EXPORT QDataStream &operator>>( QDataStream &, QDateTime & );
214#endif // QT_NO_DATASTREAM
215
216#endif // QDATETIME_H
217

Archive Download this file

Revision: 1406