summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qdatetimeparser_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Raise the upper bound on years to 9999Edward Welbourne2017-11-301-1/+1
| | | | | | | | | | | | | | | | | Test-case taken from bug-report; fits in as an easy row in an existing data-driven test. Add similar tests for date-time and time; and an isValid test on the end of year 9999. The date-time parser was using the end of year 7999 as maximum value for dates and date-times; extend this to year 9999, as I can see no reason not to. [ChangeLog][QtCore][QDateTime] Years up to 9999 can now be parsed without error (previously 8000 and beyond were treated as invalid) in all formats (not only in ISO format). Widgets handling dates now support dates to 9999, likewise. Task-number: QTBUG-64401 Change-Id: I518cfa6c2cb4ecc5a85b896dc9e56b4fdd8a8bb1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-041-4/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qconfig-bootstrapped.h src/corelib/global/qglobal.h src/corelib/tools/qcryptographichash.cpp src/corelib/tools/qcryptographichash.h src/corelib/tools/qmessageauthenticationcode.cpp src/plugins/platforms/windows/qwindowswindow.h tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST Change-Id: Ib68112de985a3d714c2071f47c10e907e4f0229a
| * Make QDateTimeParser a separate featureEdward Welbourne2017-09-251-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It was being mis-described in some places by a QT_CONFIG(timezone) test, replacing older QT_BOOTSTRAPPED checks; but it has no time-zone dependency (until 5.10). So make it a separate feature in its own right. It turns out QAbstractSpinBox's presumed dependency on datetimeedit was an illusion caused by use of QDATETIMEEDIT_*_MIN symbols actually provided by datetimeparser; so remove its bogus dependency. Change-Id: Ibc12f4a9ee35acb64a39a1c7a15d2934b5710dc0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Eliminate in/out arguments from QDateTimeParser::parse()Edward Welbourne2017-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Its first two arguments were non-const references that it modified. A copy of the first was already being passed back in the returned struct; and the one caller that wanted the modified value was in fact copying this copy back over the QString it had passed in (that was thus equal already). So passing by value is fine. The second's only change was increment by a field I've just added to StateNode in refactoring parse(); so we can let the caller do that adding, instead. Change-Id: I05abb644f3e5a60f94b03292302dd1bbe996cce9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: partial break-up of long method to eliminate gotoEdward Welbourne2017-06-201-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Method parse() was very long, had an inner block purely to isolate many variables and had a clean-up block at the end to which it would goto from within that 300-line block. Split out that block as a separate function, turn goto into premature return, clean up the result. Change-Id: I63ded0c0afacf4a1972a3a62c2d81834950ab729 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Eliminate out-parameters from QDateTimeParser::parseSection()Edward Welbourne2017-06-201-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | Return a struct instead. This frees parse() of an assumption that -1 is an error value and leaves one in/out argument. Made this last an actual pointer argument instead of a non-const ref. Shuffled the remaining arguments so that this in/out is last and the offset into it at which it gets modified is immediately before it. Removed a spurious qdoc comment in the process. Change-Id: I7d980e70a7711b1d706151eedce956fe2093e48e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: consolidate #if-ery around QT_NO_DATESTRINGEdward Welbourne2017-06-201-7/+6
| | | | | | | | | | | | | | | | | | | | 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>
* | QDateTimeParser: implement parsing of time-zone specifiersEdward Welbourne2017-06-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The serialization of date-times understood time-zones (indicated by a 't' in a format string) but the parsing didn't (so viewed the 't' as a literal element in the format string, not matched by the actual zone it needs to parse), although some tests expected it to. This made round-trip testing fail. Implemented parsing of time-zones. Re-enabled the formerly failing tests. [ChangeLog][QtCore][QDateTime] Added support for parsing of time-zones. Task-number: QTBUG-22833 Change-Id: Iddba7dca14cf9399587078d4cea19f9b95a65cf7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: rename some confusingly-named variablesEdward Welbourne2017-03-281-1/+1
|/ | | | | | | | | | | | | The parse() method's so-called "currentValue" is a caller-supplied const that isn't (because it can't be) updated to reflect what's parsed, albeit parse() passes it to other methods that presume it is (I'll fix this in a later commit). Renamed to reflect that it actually just supplies defaults for any fields not parsed from the string. Then newCurrentValue is in fact the date-time we finally end up having parsed, so rename it to reflect that. Change-Id: Ic6add2673b5b245606dbb6415d84c18fc085e456 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTimeParser: de-duplicate vtableMarc Mutz2017-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | QDateTimeEdit (QtWidgets) inherits its Private class from QDateTimeParser. By making the destructor (usually the first non-inline, non-pure, virtual function, and therefore the trigger for most compilers to emit the vtable and type_info structures for the class in that TU) out-of-line, vtables and, more importantly, type_info structures for the class are pinned to a single TU. This prevents false negative dynamic_cast and catch evaluation. Since the class is already exported, users of these classes are unaffected by the change, and since it's private API, we don't need to avoid adding code to the out-of-line destructor until Qt 6. Task-number: QTBUG-45582 Change-Id: Id57289a7eff13564dddeca0af1c45a6180c36c48 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-251-41/+43
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/qcoregraphics.mm src/gui/painting/qcoregraphics_p.h src/plugins/platforms/cocoa/qcocoahelpers.h src/plugins/platforms/cocoa/qcocoahelpers.mm Change-Id: Ibe5efcae73526b3d3931ed22730b13d372dcf54e
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-251-41/+43
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qml_module.prf src/corelib/tools/qdatetimeparser_p.h Change-Id: I5382cee3ddb33107dc61ee20f7a9188c4a68a882
| | * QDateTimeParser: introduce at least some encapsulationEdward Welbourne2016-11-231-39/+42
| | | | | | | | | | | | | | | | | | | | | | | | Shuffled its parts to make clear which bits are public, private and protected. QDateTimeEditPrivate makes rather heavy use of the last. Change-Id: Ic5f9d0c5cc85f02e57d3f31e9ac31a17428c5311 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Make sure all private headers in Qt Core include qglobal_p.hThiago Macieira2016-06-251-0/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | The rule was: - if the header included qglobal.h, turn that into qglobal_p.h - otherwise, insert the #include after the "We mean it" warning qglobal_p.h currently only includes qglobal.h. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QDateTimeParser: adapt to make good use of QStringRef.Anton Kudryavtsev2016-05-301-2/+12
| | | | | | | | | | | | | | | | | | | | Avoid unnecessary allocations. Create QString from QStringRef only where necessary. Change-Id: I8f2a7dce51430162c84328e23ab3cc071227d6ae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-131-3/+10
|\| | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/testlib/qtestcase.cpp src/testlib/qtestcase.qdoc Change-Id: Ied3c471dbc9a076c8de33d673bd557e88575609d
| * QDateTimeParser: new Section mask values simplify code.Edward Welbourne2016-04-081-3/+9
| | | | | | | | | | | | | | | | | | Various |s of existing section flags were used repeatedly; naming these masks makes the relevant code easier to read. In QDateTimeEdit, add a comment to make clear that its Section enum is based on QDTP's. Change-Id: Ifd8364cd396a6d0d5ed7ae7dc4d31690f77edd30 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * QDateTimeParser: mediate QLocale's meddling via a setter.Edward Welbourne2016-04-081-0/+1
| | | | | | | | | | | | | | | | | | The former has (for now) nothing private, so QLocale got away with setting its .defaultLocale explicitly; provide a setter method by which it can do that, to allow scope for later encapsulation. Change-Id: I77fc5fc8f868fc7cf8d51eb1c5d18926c61cbf78 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-111-19/+21
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemwatcher_win.cpp src/corelib/plugin/plugin.pri src/plugins/platforms/cocoa/qcocoaaccessibility.mm tests/auto/corelib/tools/qlocale/tst_qlocale.cpp Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
| * Make findAmPm actually return the relevant enum, instead of int.Edward Welbourne2016-02-041-2/+2
| | | | | | | | | | | | | | | | 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>
| * Disintermediate QDateTimeParser::SectionNode operations.Edward Welbourne2016-02-021-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The name, format and maxChange of a Section depend only on the section, not on the details of the currently parsed text it matches; so we don't need the parser object's list of all sections to work them out. Move these methods to the SectionNode and act directly on that instead of going via the section list. Make the name take a Section enum instead of an int. Likewise, make stateName take a State enum instead of an int. Change-Id: Ie340d042ab95aec517013c4dcc30901d40305c78 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| * Make interleaving of QDateTimeParser::Section values evident.Edward Welbourne2016-02-021-11/+12
| | | | | | | | | | | | | | | | | | | | The actual section members grew up to the internal value, leading to interleaving of subsequently-added values. Change existing enum values to make this go away (class is private, so no BC constraint forbids this). Change-Id: If266b557817eae19d375519bf38268f0f2a0d372 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-021-1/+1
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * Set correct Section type for QDateTimeParser::lastEdward Welbourne2016-01-291-1/+1
| | | | | | | | | | | | | | | | Setting it to FirstSection was obviously wrong and left LastSection nowhere set ... Change-Id: I26260182e9d986b41b5f3a5d6df94540a5fc116a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QtCore: mark some more types as movable/primitiveMarc Mutz2015-07-071-0/+1
| | | | | | | | These are already held in QVectors. Change-Id: I6fe831ba5b75d792fd13e63ef0d2e178b52e1107 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Translate AM/PM under the QDateTimeParser context so it is consistentAndy Shaw2015-05-281-1/+2
| | | | | | | | | | In order to ensure that the same text will be used in both QDateTimeParser and QDateTimeEdit, use the QDateTimeParser context for the AM and PM strings. Task-number: QTBUG-251 Change-Id: I89b0809825251181440bf19cbe5828024a43acfb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Fix some typosSergio Ahumada2014-03-031-1/+1
| | | | | | Change-Id: I7dbe938bff5ac3ab50a0197f94bdb2f6c22fbd16 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QDateTime - Split QDateTimeParser into a separate fileJohn Layt2013-09-091-0/+272
Not strictly needed yet, but helps to reduce the size of QDateTime and make it easier to read a major re-write. Imposes separation of parser which will be needed if we make QLocale always use the system backends, after which only QDateTimeEdit widget will need the parser and it can be moved there. Change-Id: I6a5e9a3edf6fe8ff2340af6afecd8ba4bfde9dd4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>