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 <thiago.macieira@intel.com>
bb10
Edward Welbourne 2016-12-15 10:42:27 +01:00
parent 68f19fb630
commit e2eafc0c27
2 changed files with 8 additions and 14 deletions

View File

@ -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 &currentValue, 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

View File

@ -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 &currentValue, 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 &currentValue, int insert) const;
bool potentialValue(const QString &str, int min, int max, int index,