From e2eafc0c271e44fd9e8969b003e7f8ecd57cd2e6 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 15 Dec 2016 10:42:27 +0100 Subject: QDateTimeParser: consolidate #if-ery around QT_NO_DATESTRING Some private methods were conditioned on QT_NO_TEXTDATE but called (without #if-ery) by methods conditioned on QT_NO_DATESTRING; and various private methods without #if-ery were only called by methods within. Consolidate to #if methods all on QT_NO_DATESTRING. Change-Id: I1dd18037e4e7407c07041036cc5b871b7d693016 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetimeparser.cpp | 9 ++------- src/corelib/tools/qdatetimeparser_p.h | 13 ++++++------- 2 files changed, 8 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 4ea6f8764f..b81956a381 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -719,7 +719,7 @@ QString QDateTimeParser::sectionText(int sectionIndex) const } -#ifndef QT_NO_TEXTDATE +#ifndef QT_NO_DATESTRING /*! \internal:skipToNextSection @@ -908,9 +908,7 @@ int QDateTimeParser::parseSection(const QDateTime ¤tValue, int sectionInde return (state != Invalid ? num : -1); } -#endif // QT_NO_TEXTDATE -#ifndef QT_NO_DATESTRING /*! \internal @@ -1500,9 +1498,6 @@ end: text = input; return node; } -#endif // QT_NO_DATESTRING - -#ifndef QT_NO_TEXTDATE /* \internal @@ -1590,7 +1585,6 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex const int index = findTextEntry(str1, daysOfWeek, usedDay, used); return index < 0 ? index : index + startDay; } -#endif // QT_NO_TEXTDATE /*! \internal @@ -1736,6 +1730,7 @@ QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionI return PossibleBoth; return (!broken[amindex] ? PossibleAM : PossiblePM); } +#endif // QT_NO_DATESTRING /*! \internal diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index 25afd3a2ad..ee6f9f3054 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -179,11 +179,9 @@ public: #ifndef QT_NO_DATESTRING StateNode parse(QString &input, int &cursorPosition, const QDateTime &defaultValue, bool fixup) const; -#endif - bool parseFormat(const QString &format); -#ifndef QT_NO_DATESTRING bool fromString(const QString &text, QDate *date, QTime *time) const; #endif + bool parseFormat(const QString &format); enum FieldInfoFlag { Numeric = 0x01, @@ -201,14 +199,15 @@ public: private: int sectionMaxSize(Section s, int count) const; QString sectionText(const QString &text, int sectionIndex, int index) const; +#ifndef QT_NO_DATESTRING int parseSection(const QDateTime ¤tValue, int sectionIndex, QString &txt, int &cursorPosition, int index, QDateTimeParser::State &state, int *used = 0) const; -#ifndef QT_NO_TEXTDATE 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 + int findTimeZone(QStringRef str, const QDateTime&when, int *used) const; + static int startsWithLocalTimeZone(const QStringRef name); // implemented in qdatetime.cpp enum AmPmFinder { Neither = -1, @@ -219,8 +218,8 @@ private: PossibleBoth = 4 }; AmPmFinder findAmPm(QString &str, int index, int *used = 0) const; - int findTimeZone(QStringRef str, const QDateTime&when, int *used) const; - static int startsWithLocalTimeZone(const QStringRef name); // implemented in qdatetime.cpp +#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, -- cgit v1.2.3