summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qdatetimeparser.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2016-01-18 18:26:17 +0100
committerEdward Welbourne <edward.welbourne@theqtcompany.com>2016-02-04 09:14:02 +0000
commitf432d6401938aa3a326b4ea205f310d2559f9961 (patch)
tree40f56e8b67dc48b73ed1bc36b2722ce265989fb7 /src/corelib/tools/qdatetimeparser.cpp
parenta054349be3ea8e68279ee3f478cc98e1ac522fe4 (diff)
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>
Diffstat (limited to 'src/corelib/tools/qdatetimeparser.cpp')
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 26449750d0..d4004098c5 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -1355,22 +1355,20 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex
/*!
\internal
- returns
- 0 if str == tr("AM")
- 1 if str == tr("PM")
- 2 if str can become tr("AM")
- 3 if str can become tr("PM")
- 4 if str can become tr("PM") and can become tr("AM")
- -1 can't become anything sensible
-
+ Returns
+ AM if str == tr("AM")
+ PM if str == tr("PM")
+ PossibleAM if str can become tr("AM")
+ PossiblePM if str can become tr("PM")
+ PossibleBoth if str can become tr("PM") and can become tr("AM")
+ Neither if str can't become anything sensible
*/
-
-int QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const
+QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const
{
const SectionNode &s = sectionNode(sectionIndex);
if (s.type != AmPmSection) {
qWarning("QDateTimeParser::findAmPm Internal error");
- return -1;
+ return Neither;
}
if (used)
*used = str.size();