author | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
commit | 6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4 (patch) (unidiff) | |
tree | 6ebc93c6432f4ed9d00ef1448b6a047ef522a79a /library/timestring.h | |
parent | d10cddb3c9ce75bc90b14add14bc133737fe35aa (diff) | |
download | opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.zip opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.gz opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.bz2 |
Qtopia1-6 merge
still to test
bic changes to be resolved
more changes to be made?
-rw-r--r-- | library/timestring.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/library/timestring.h b/library/timestring.h index fd06d5b..f8cb3e6 100644 --- a/library/timestring.h +++ b/library/timestring.h | |||
@@ -1,36 +1,36 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef _TIMESTRING_H_ | 21 | #ifndef _TIMESTRING_H_ |
22 | #define _TIMESTRING_H_ | 22 | #define _TIMESTRING_H_ |
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | 25 | ||
26 | // return a string with the time based on whether or not you want | 26 | // return a string with the time based on whether or not you want |
27 | // you want it in 12 hour form. if ampm is true, then return | 27 | // you want it in 12 hour form. if ampm is true, then return |
28 | // it in 12 hour (am/pm) form otherwise return it in 24 hour form | 28 | // it in 12 hour (am/pm) form otherwise return it in 24 hour form |
29 | // in theory Qt 3,0 handles this better (hopefully obsoleteing this) | 29 | // in theory Qt 3,0 handles this better (hopefully obsoleteing this) |
30 | class DateFormat | 30 | class DateFormat |
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | // date format type 001,010,100 = day month year | 33 | // date format type 001,010,100 = day month year |
34 | enum Order { | 34 | enum Order { |
35 | DayMonthYear = 0x0111, // 0x001 + 0x010(0x2 << 3) + 0x100(0x4 << 3) | 35 | DayMonthYear = 0x0111, // 0x001 + 0x010(0x2 << 3) + 0x100(0x4 << 3) |
36 | MonthDayYear = 0x010A, | 36 | MonthDayYear = 0x010A, |
@@ -85,47 +85,52 @@ private: | |||
85 | Order _longOrder; | 85 | Order _longOrder; |
86 | QChar _shortSeparator; | 86 | QChar _shortSeparator; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | #ifndef QT_NO_DATASTREAM | 89 | #ifndef QT_NO_DATASTREAM |
90 | QDataStream &operator<<(QDataStream &s, const DateFormat&df); | 90 | QDataStream &operator<<(QDataStream &s, const DateFormat&df); |
91 | QDataStream &operator>>(QDataStream &s, DateFormat&df); | 91 | QDataStream &operator>>(QDataStream &s, DateFormat&df); |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | class TimeString | 94 | class TimeString |
95 | { | 95 | { |
96 | public: | 96 | public: |
97 | 97 | ||
98 | //enum DateFormat { MonthDayYear, DayMonthYear, ISO8601, | 98 | //enum DateFormat { MonthDayYear, DayMonthYear, ISO8601, |
99 | //YearMonthDay = ISO8601 }; | 99 | //YearMonthDay = ISO8601 }; |
100 | 100 | ||
101 | 101 | ||
102 | static QString shortDate( const QDate &d ) | 102 | static QString shortDate( const QDate &d ) |
103 | { return shortDate( d, currentDateFormat() ); } | 103 | { return shortDate( d, currentDateFormat() ); } |
104 | static QString dateString( const QDate &d ) | 104 | static QString dateString( const QDate &d ) |
105 | { return dateString( d, currentDateFormat() ); } | 105 | { return dateString( d, currentDateFormat() ); } |
106 | static QString longDateString( const QDate &d ) | 106 | static QString longDateString( const QDate &d ) |
107 | { return longDateString( d, currentDateFormat() ); } | 107 | { return longDateString( d, currentDateFormat() ); } |
108 | static QString dateString( const QDateTime &dt, bool ampm, bool seconds ) | 108 | static QString dateString( const QDateTime &dt, bool ampm, bool seconds ) |
109 | { return dateString( dt, ampm, seconds, currentDateFormat() ); } | 109 | { return dateString( dt, ampm, seconds, currentDateFormat() ); } |
110 | 110 | ||
111 | static QString dateString( const QDateTime &t, bool ampm = false ); | 111 | static QString dateString( const QDateTime &t, bool ampm = false ); |
112 | static QString timeString( const QTime &t, bool ampm, bool seconds ); | 112 | static QString timeString( const QTime &t, bool ampm, bool seconds ); |
113 | static QString timeString( const QTime &t, bool ampm = false ); | 113 | static QString timeString( const QTime &t, bool ampm = false ); |
114 | static QString shortTime( bool ampm, bool seconds ); | 114 | static QString shortTime( bool ampm, bool seconds ); |
115 | static QString shortTime( bool ampm = false ); | 115 | static QString shortTime( bool ampm = false ); |
116 | 116 | ||
117 | 117 | static QString numberDateString( const QDate &d, DateFormat ); | |
118 | static QString numberDateString( const QDate &d ) | ||
119 | { return numberDateString( d, currentDateFormat() ); } | ||
120 | static QString longNumberDateString( const QDate &d, DateFormat ); | ||
121 | static QString longNumberDateString( const QDate &d ) | ||
122 | { return longNumberDateString( d, currentDateFormat() ); } | ||
118 | 123 | ||
119 | static QString shortDate( const QDate &, DateFormat ); | 124 | static QString shortDate( const QDate &, DateFormat ); |
120 | static QString dateString( const QDate &, DateFormat ); | 125 | static QString dateString( const QDate &, DateFormat ); |
121 | static QString longDateString( const QDate &, DateFormat ); | 126 | static QString longDateString( const QDate &, DateFormat ); |
122 | 127 | ||
123 | static DateFormat currentDateFormat(); | 128 | static DateFormat currentDateFormat(); |
124 | 129 | ||
125 | private: | 130 | private: |
126 | static QString dateString( const QDateTime &t, bool ampm, bool seconds, DateFormat ); | 131 | static QString dateString( const QDateTime &t, bool ampm, bool seconds, DateFormat ); |
127 | 132 | ||
128 | 133 | ||
129 | }; | 134 | }; |
130 | #endif | ||
131 | 135 | ||
136 | #endif | ||