diff options
Diffstat (limited to 'src/corelib/tools/qdatetimeparser_p.h')
-rw-r--r-- | src/corelib/tools/qdatetimeparser_p.h | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index b50c88b4c1..f6f9ed5e24 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -113,9 +113,10 @@ public: MinuteSection = 0x00008, Hour12Section = 0x00010, Hour24Section = 0x00020, + TimeZoneSection = 0x00040, HourSectionMask = (Hour12Section | Hour24Section), TimeSectionMask = (MSecSection | SecondSection | MinuteSection | - HourSectionMask | AmPmSection), + HourSectionMask | AmPmSection | TimeZoneSection), DaySection = 0x00100, MonthSection = 0x00200, @@ -159,11 +160,14 @@ public: }; struct StateNode { - StateNode() : state(Invalid), conflicts(false) {} + StateNode() : state(Invalid), padded(0), conflicts(false) {} + StateNode(const QDateTime &val, State ok=Acceptable, int pad=0, bool bad=false) + : value(val), state(ok), padded(pad), conflicts(bad) {} QString input; + QDateTime value; State state; + int padded; bool conflicts; - QDateTime value; }; enum AmPm { @@ -177,12 +181,10 @@ public: }; #ifndef QT_NO_DATESTRING - StateNode parse(QString &input, int &cursorPosition, const QDateTime ¤tValue, bool fixup) const; -#endif - bool parseFormat(const QString &format); -#ifndef QT_NO_DATESTRING + StateNode parse(QString input, int position, const QDateTime &defaultValue, bool fixup) const; bool fromString(const QString &text, QDate *date, QTime *time) const; #endif + bool parseFormat(const QString &format); enum FieldInfoFlag { Numeric = 0x01, @@ -200,14 +202,28 @@ public: private: int sectionMaxSize(Section s, int count) const; QString sectionText(const QString &text, int sectionIndex, int index) const; - int parseSection(const QDateTime ¤tValue, int sectionIndex, QString &txt, int &cursorPosition, - int index, QDateTimeParser::State &state, int *used = 0) const; -#ifndef QT_NO_TEXTDATE +#ifndef QT_NO_DATESTRING + StateNode scanString(const QDateTime &defaultValue, + bool fixup, QString *input) const; + struct ParsedSection { + int value; + int used; + int zeroes; + State state; + Q_DECL_CONSTEXPR ParsedSection(State ok = Invalid, + int val = 0, int read = 0, int zs = 0) + : value(ok == Invalid ? -1 : val), used(read), zeroes(zs), state(ok) + {} + }; + ParsedSection parseSection(const QDateTime ¤tValue, int sectionIndex, + int offset, QString *text) const; int findMonth(const QString &str1, int monthstart, int sectionIndex, QString *monthName = 0, int *used = 0) const; int findDay(const QString &str1, int intDaystart, int sectionIndex, QString *dayName = 0, int *used = 0) const; -#endif + ParsedSection findTimeZone(QStringRef str, const QDateTime &when, + int maxVal, int minVal) const; + static int startsWithLocalTimeZone(const QStringRef name); // implemented in qdatetime.cpp enum AmPmFinder { Neither = -1, @@ -218,6 +234,8 @@ private: PossibleBoth = 4 }; AmPmFinder findAmPm(QString &str, int index, int *used = 0) const; +#endif // QT_NO_DATESTRING + bool potentialValue(const QStringRef &str, int min, int max, int index, const QDateTime ¤tValue, int insert) const; bool potentialValue(const QString &str, int min, int max, int index, |