Make findAmPm actually return the relevant enum, instead of int.
The enum needed a name to make that possible, of course. The one overt int return -1 needed to be made explicitly Neither, too. Change-Id: I3930bf03a7ee5e1619a1c74f9ca54faf6a6c5b2f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
This commit is contained in:
parent
a054349be3
commit
f432d64019
@ -1355,22 +1355,20 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
|
|
||||||
returns
|
Returns
|
||||||
0 if str == tr("AM")
|
AM if str == tr("AM")
|
||||||
1 if str == tr("PM")
|
PM if str == tr("PM")
|
||||||
2 if str can become tr("AM")
|
PossibleAM if str can become tr("AM")
|
||||||
3 if str can become tr("PM")
|
PossiblePM if str can become tr("PM")
|
||||||
4 if str can become tr("PM") and can become tr("AM")
|
PossibleBoth if str can become tr("PM") and can become tr("AM")
|
||||||
-1 can't become anything sensible
|
Neither if str can't become anything sensible
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const
|
||||||
int QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const
|
|
||||||
{
|
{
|
||||||
const SectionNode &s = sectionNode(sectionIndex);
|
const SectionNode &s = sectionNode(sectionIndex);
|
||||||
if (s.type != AmPmSection) {
|
if (s.type != AmPmSection) {
|
||||||
qWarning("QDateTimeParser::findAmPm Internal error");
|
qWarning("QDateTimeParser::findAmPm Internal error");
|
||||||
return -1;
|
return Neither;
|
||||||
}
|
}
|
||||||
if (used)
|
if (used)
|
||||||
*used = str.size();
|
*used = str.size();
|
||||||
|
@ -97,7 +97,7 @@ public:
|
|||||||
none.zeroesAdded = 0;
|
none.zeroesAdded = 0;
|
||||||
}
|
}
|
||||||
virtual ~QDateTimeParser() {}
|
virtual ~QDateTimeParser() {}
|
||||||
enum {
|
enum AmPmFinder {
|
||||||
Neither = -1,
|
Neither = -1,
|
||||||
AM = 0,
|
AM = 0,
|
||||||
PM = 1,
|
PM = 1,
|
||||||
@ -201,7 +201,7 @@ public:
|
|||||||
int findDay(const QString &str1, int intDaystart, int sectionIndex,
|
int findDay(const QString &str1, int intDaystart, int sectionIndex,
|
||||||
QString *dayName = 0, int *used = 0) const;
|
QString *dayName = 0, int *used = 0) const;
|
||||||
#endif
|
#endif
|
||||||
int findAmPm(QString &str1, int index, int *used = 0) const;
|
AmPmFinder findAmPm(QString &str, int index, int *used = 0) const;
|
||||||
bool potentialValue(const QString &str, int min, int max, int index,
|
bool potentialValue(const QString &str, int min, int max, int index,
|
||||||
const QDateTime ¤tValue, int insert) const;
|
const QDateTime ¤tValue, int insert) const;
|
||||||
bool skipToNextSection(int section, const QDateTime ¤t, const QString §ionText) const;
|
bool skipToNextSection(int section, const QDateTime ¤t, const QString §ionText) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user