1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the core module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
32
#include "qplatformdefs.h"
35
#include "qdatetime.h"
39
class QDateTimePrivate
42
enum Spec { LocalUnknown = -1, LocalStandard = 0, LocalDST = 1, UTC = 2 };
44
QDateTimePrivate() : ref(1), spec(LocalUnknown) {}
45
QDateTimePrivate(const QDateTimePrivate &other)
46
: ref(1), date(other.date), time(other.time), spec(other.spec)
54
Spec getLocal(QDate &outDate, QTime &outTime) const;
55
void getUTC(QDate &outDate, QTime &outTime) const;
63
enum QDateTimeParserSkipMode {
69
NoSection = 0x0000000,
75
DayMask = (Day1|Day2|Day3|Day4),
81
MonthMask = (Month1|Month2|Month3|Month4),
85
YearMask = (Year2|Year4),
86
DateMask = (DayMask|MonthMask|YearMask),
90
HourMask = (Hour1|Hour2),
94
MinuteMask = (Minute1|Minute2),
98
SecondMask = (Second1|Second2),
100
MSecond1 = 0x0010000,
101
MSecond3 = 0x0020000,
102
MSecondMask = (MSecond1|MSecond3),
106
APMask = (APLower|APUpper),
108
TimeMask = (HourMask|MinuteMask|SecondMask|MSecondMask),
111
Separator = 0x0200000,
112
FirstSection = 0x0400000,
113
LastSection = 0x0800000
116
QDateTimeParser(const QString &f = QString(), QVariant::Type t = QVariant::DateTime);
117
bool isSpecial(const QChar &c) const;
118
QFormatSection findNextFormat(const QString &str, const int start);
119
void parseFormat(const QString &format, QVariant::Type t);
120
bool fromString(const QString &string, QDate *dateIn, QTime *timeIn);
122
static bool withinBounds(QDateTimeParser::Section t, int num);
123
static int getNumber(int index, const QString &str, int mindigits, int maxdigits, bool *ok, int *digits);
125
static QFormatSection firstSection;
126
static QFormatSection lastSection;
128
QVariant::Type formatType;
129
QList<QFormatSection> sect;
137
QFormatSection(int ind, const QString &sep);
138
QFormatSection(int ind = -1, QDateTimeParser::Section typ = QDateTimeParser::NoSection);
140
static int length(QDateTimeParser::Section t);
141
bool variableLength() const;
145
QDateTimeParser::Section type;
148
#endif // QDATETIME_P_H