summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qdatetimeparser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Separate out the time, zone, date code from corelib/tools/Edward Welbourne2019-06-061-2047/+0
| | | | | | | | | | We'll be adding calendar code here as well, and tools/ was getting rather crowded, so it looks like time to move out a reasonably coherent sub-bundle of it all. Change-Id: I7e8030f38c31aa307f519dd918a43fc44baa6aa1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QDateTimeParser: use qUtf16Printable() and %lsMarc Mutz2019-05-291-29/+29
| | | | | | | | | | | | ... instead of qPrintable() and %s. Avoids temporary QByteArrays. Saves 1.2KiB in text size on optimized Linux AMD64 GCC 9.1 builds. Change-Id: Ie626fc478667007ce9a6bc920b8d4ec0451f2cd0 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
* Add startOfDay() and endOfDay() methods to QDateEdward Welbourne2019-04-241-5/+5
| | | | | | | | | | | | | | | | | | | These methods give the first and last QDateTime values in the given day, for a given time-zone or time-spec. These are usually the relevant midnight, or the millisecond before, except when time-zone transitions (typically DST changes) skip it, when care is needed to select the right moment. Adapted some code to make use of the new API, eliminating some old cruft from qdatetimeparser_p.h in the process. [ChangeLog][QtCore][QDate] Added startOfDay() and endOfDay() methods to provide a QDateTime at the start and end of a given date, taking account of any time skipped by transitions, e.g. a DST spring-forward, which can lead to a day starting at 01:00 or ending just before 23:00. Task-number: QTBUG-64485 Change-Id: I3dd7a34bedfbec8f8af00c43d13f50f99346ecd0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegExp include cleanupSamuel Gaist2019-04-191-1/+0
| | | | | | | | | | | | | | | | QRegExp includes can be found in several files where there's not even a use of the class. This patch aims to avoid needless includes as well as follow the "include only what you use" moto. This patch removes a QRegExp include from the QStringList header which means that there is likely going to be code breaking since QStringList is used in many places and would get QRegExp in. [ChangeLog][Potentially Source-Incompatible Changes] qstringlist.h no longer includes qregexp.h. Change-Id: I32847532f16e419d4cb735ddc11a26551127e923 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Avoid read-outside-array error by QStringRef over-reachEdward Welbourne2019-02-081-5/+6
| | | | | | | | | | | | | | | | | | | Constructing a QStringRef directly from the string, offset and a length is UB if the offset + length exceeds the string's length. Thanks to Robert Loehning and libFuzzer for finding this. QString::midRef (as correctly used in both changed uses of QStringRef, since 432d3b69629) takes care of that for us. Changed one UB case and a matching but correct case, for consistency. In the process, deduplicate a QStringList look-up. Added tests to exercise the code (but the one that exercises the formerly UB case doesn't crash before the fix, so isn't very useful; the invalid read is only outside the array it's scanning, not outside allocated memory). Change-Id: I7051bbbc0267dd7ec0a8f75eee2034d0b7eb75a2 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTimeParser: avoid using an invalid hour by defaultEdward Welbourne2018-10-021-4/+25
| | | | | | | | | | | | When a time-zone does a spring-forward, skipping an hour (either to start DST or to move its standard time), there's an hour that doesn't exist on the day in question. That hour can be the first hour of the day, in which case using 0:0 as the default time is broken. So catch this case and use the first time that day that makes sense. Fixes: QTBUG-70823 Change-Id: I23dae9320a3cdd2c988841a7db1b111edb945730 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Modernize the "datestring" featureLiang Qi2018-09-241-7/+7
| | | | | | Change-Id: I2236a456fe3758d9054b22e36fe6316f3522d533 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Modernize the "textdate" featureLiang Qi2018-09-241-3/+3
| | | | | | Change-Id: Ic0b6f13e17c301ed66d6a8297c242086c94ac87d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build without features.timezoneTasuku Suzuki2018-05-081-0/+2
| | | | | Change-Id: I3f8421103afa61baf415636b4dc8cf93fb477bcc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-11/+37
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * Merge remote-tracking branch 'origin/5.10.0' into 5.10Liang Qi2017-12-081-1/+6
| |\ | | | | | | | | | Change-Id: I6dcf85067ec226136c207ea69ca9d66736c84db5
| | * Special-case parsing of Zulu time-zone in date-timesEdward Welbourne2017-11-141-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When parsing a date-time's zone, a stray Z denotes UTC (a.k.a. Zulu time), despite not being a valid name for the zone. Clients parsing such date strings had to treat the Z as a literal, rather than a zone-ID, but then they got back a LocalTime instead of the UTC the string actually described. So teach QTimeZoneParser to handle this special case and adapt an existing test (that used a time ending in Z, but had to treat it as a local time) to check this works. [ChangeLog][QtCore][QDateTime] When parsing a time-zone, "Z" is now recognized as an alias for UTC. Change-Id: Ib6aa2d8ea2dc6b2da526b39aec74dbc007f90fd8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | Condition QDateTimeParser's time-zone parsing on QT_CONFIG(timezone)Edward Welbourne2017-11-301-10/+31
| |/ | | | | | | | | | | | | It was missing some #if-ery it needed. Change-Id: Ibc12f4a9ee35acb64a39a1c7a15d2934b5710dc0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Tidy up QDateTimeParser code to make it easier to reason aboutEdward Welbourne2017-11-301-9/+10
| | | | | | | | | | | | | | | | | | | | Note that the relevant cases are all numeric, eliminate a redundant variable (the min of two others, one of which was provably <= the other), invert and rename a boolean (that was always used negated), eliminate a case that couldn't arise (and assert this). Change-Id: I9ef9cedbeb608c7cd56ddc618ddfb921966edfbf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: reject all short values in fixed-width fieldsEdward Welbourne2017-11-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a 1, 2 or 3 for "dd" would be rejected because 10, 20 or 30 would fit in the field and be valid; but 4 or more was accepted, even though it was too short for the field, because no suffix could make it valid within the field-width. [ChangeLog][QtCore][QDateTime] When parsing dates and times from strings, fixed-width date-time fields, such as a "dd" for day, QDateTime now rejects all values that should be padded, rather than only doing so when the value is a prefix of some value that would fill the field-width. Use a single letter for the field, e.g. "d" for day, if you want to accept short values. (QDateTimeEdit is not affected.) Task-number: QTBUG-63072 Change-Id: I22d223c50057c3edab4ef7f01d9ed0f58e9139c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Raise the upper bound on years to 9999Edward Welbourne2017-11-301-2/+2
|/ | | | | | | | | | | | | | | | | 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>
* QDateTimeParser: Remove unused variableRobert Loehning2017-11-021-1/+0
| | | | | | Change-Id: Iaa6460d4eb96632f3cb03bc29b57934c53cbf88e Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-041-4/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-282/+283
| | | | | | | | | | | | | | | | | | | | | | | | 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-104/+77
| | | | | | | | | | | | | | | | | | | | | | | | 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/+2
| | | | | | | | | | | | | | | | | | | | 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-30/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Tidy implementation and use of QDateTimeParser::setDigit()Edward Welbourne2017-06-131-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation did a validity check on data it then gave to constructors that repeat the validity checks; so do the construction first and use the cheaper instance isValid() methods instead. Fixed local callers (but not QDateTimeEditPrivate::stepBy, the only other caller) to actually attend to the return value; if the attempt to set a field fails, it probably means the min is too low, or max too high; and comparing the modified date-time against global min and max makes no sense if it hasn't been revised anyway. Change-Id: If4505c43c92e247445dcd10ac436b775c3ead4da Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: pass down an actual current value where expectedEdward Welbourne2017-05-221-1/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Method parse() was passing down its default value argument to various methods that expected an argument reflecting what's been parsed thus far. Pass them what they expected ! Most are fairly insensitive to the details at present, but the zone parsing I intend to add needs to know the right date to compute its offset. This makes it necessary to work out a sensible date and time to use, from the fragments seen so far, using the default value to fill in gaps but deviating from it wherever it conflicts with the actual values seen. Change-Id: I76750fcd92c1bdcad15c7dd4d8002cb90cec94ba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Tidy up QDateTimeParser in assorted petty waysEdward Welbourne2017-04-181-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A bit-field was necessarily equal to either zero or its (single-bit) mask; so comparing to the mask was superfluous. A local value set and then conditionally over-ridden could easily be made const by using the condition in a ?: assignment. A use of qMin() lent itself to turning into a simple conditional assignment. Change-Id: I541d98044b23b8c51e6169f617a5841ba8fffc55 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: simpler return, clearer commentEdward Welbourne2017-04-181-7/+6
| | | | | | | | | | | | | | | | skipToNextSection() returned via a local temp that served no purpose. The accompanying comment didn't quite explain what it set out to. Change-Id: I31581323df374653db9c2558a3bd63409aafb178 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: simplify switch by exploiting fall-throughEdward Welbourne2017-04-181-6/+4
| | | | | | | | | | | | | | | | Several cases all fell together; their code tested away one of them; so putting it last and falling through to it avoids the need to test. Change-Id: I0bf555710604a56faa61b60bfe5484d5c5a1ee6b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: rename some confusingly-named variablesEdward Welbourne2017-03-281-33/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: tidy up reading of numeric parts of a dateEdward Welbourne2017-03-281-9/+7
|/ | | | | | | | Make some variables more local. Make a loop simpler (and run it earlier). Change-Id: I28c0c933b2a6599973d70d66105da6046189d8eb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Bugfix in QDateTimeParser's findTextEntry()Edward Welbourne2017-03-091-4/+10
| | | | | | | | | | | | | | If a later month-or-day were to have a name that's a prefix of an earlier one's name, the code would have selected the longer name as best match when the text matched is the shorter name, simply because it found that one first. (Found, on Turkish Cuma(rtesi)? in Thiago's recent new test, by reversing the loop that iterated the list.) Make an exact match win and a match of a full name beat any prefix match of the same length. Change-Id: I8d954b83ccc25e4f47af2e558036d714685cef5e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify QDateTimeParser's shiny new findTextEntry()Edward Welbourne2017-03-091-13/+25
| | | | | | | | | Decouple from the callers' offset into a larger list; just search for an entry in a list, let the caller deal with the offset. Also, defer a .tolower() to save the need to allocate a copy of each list entry. Change-Id: I748d5214c2cc6dc592fe2bd41e3f8150f71c335b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTimeParser: Merge the code to parse names of months and weekdaysThiago Macieira2017-03-081-85/+51
| | | | | | | | Simplifies everything and avoids bugfixes in one not propagating to the other. Change-Id: I95c9e502ccc74af3bcf0fffd14a69f0cde60cc8c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix parsing of day-of-week names that start with another nameThiago Macieira2017-02-281-32/+9
| | | | | | Task-number: QTBUG-59159 Change-Id: I95c9e502ccc74af3bcf0fffd14a69e0cd27ce96b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDateTimeParser: de-duplicate vtableMarc Mutz2017-02-051-0/+4
| | | | | | | | | | | | | | | | | | | | 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>
* QtCore: fix GCC 7 warningsMarc Mutz2017-01-151-0/+1
| | | | | | | | | GCC 7 warns about implicit fall-throughs now. Fix by adding Q_FALLTHROUGH. Change-Id: I482ab4c6adc469b11e1fd163516ff486b3b55ef7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime::fromString(): improve performance by 33%David Faure2017-01-031-5/+15
| | | | | | | | | | | | | | | | getMaximum() and getMinimum(), called during parsing, create new QDateTime instances, which on Linux end up calling mktime(). Making these static (for the common case of LocalTime spec) improves performance dramatically, when parsing several date/times. tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to actually parse a valid date/time) says: RESULT : tst_QDateTime::fromString(): - 36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1) + 24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1) Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-241-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/network/socket/qnativesocketengine_winrt.cpp tools/configure/configureapp.cpp tools/configure/environment.cpp Change-Id: Ieae6f2ee004a87f041751852b687484f91ee4480
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-231-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 0d2f0164f45cb626c40a7c95026ba00fa56ac249. Conflicts: header.BSD-NEW qmake/Makefile.win32 src/openglextensions/qopenglextensions.cpp src/openglextensions/qopenglextensions.h src/winmain/qtmain_win.cpp src/winmain/qtmain_winrt.cpp tools/configure/configureapp.cpp util/glgen/qopenglextensions.cpp.header util/glgen/qopenglextensions.h.header Change-Id: If26c6f4111b342378dd88bbdc657e322d2ab6ad8
| | * QDateTimeParser: localize variable to avoid shadowingEdward Welbourne2016-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The outer scope it was in had a later clause with its own pos variable. Change-Id: I8d083d3d5935416ef82a78890ed145f02d6d6ded Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Merge dev into 5.8Oswald Buddenhagen2016-08-221-5/+3
|\| | | | | | | | | | | Change-Id: I41ee7b50534b01cf042bed8bb8824ba2e5026a29
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-5/+3
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/io/qsettings.cpp src/corelib/itemmodels/qstringlistmodel.cpp tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
| | * QDateTimeParser::getAmPmText() use QLocale instead of tr()Edward Welbourne2016-08-111-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I am not convinced toUpper/toLower is a generally sound solution here; however, QLocale doesn't make the upper/lower case distinction this parser does and a bug report shows tr() isn't doing an adequate job. Task-number: QTBUG-47815 Change-Id: Iaf654d1d76d4c38d74fc647e168d50debb924a8f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Support C++17 fallthrough attributeAllan Sandfeld Jensen2016-08-191-5/+6
|/ / | | | | | | | | | | | | | | | | Replaces our mix of comments for annotating intended absence of break in switches with the C++17 attribute [[fallthrough]], or its earlier a clang extension counterpart. Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: adapt to make good use of QStringRef.Anton Kudryavtsev2016-05-301-11/+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>
* | QDateTimeParser: use QStringRef moreAnton Kudryavtsev2016-05-131-9/+8
| | | | | | | | | | | | | | Avoid unnecessary allocations. Change-Id: I217ba3fe20293f5cdeeaac2dfae15f837cda51e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: adapt unquote() to make good use of QStringRef.Anton Kudryavtsev2016-05-111-6/+4
| | | | | | | | | | | | | | | | Avoid unnecessary allocations. Change-Id: I9bed622c0dd7d9fe993b52d9169d1773957da4f2 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QDateTimeParser: de-duplicate calls and cache resultsAnton Kudryavtsev2016-05-111-7/+9
| | | | | | | | | | | | Change-Id: I0d6065fbdd19acff14072ff626585e8a12a3e073 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QDateTimeParser: proper construction of QStringAnton Kudryavtsev2016-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | ... with known size and known char by corresponding ctor. Don't use fill() for this case. Change-Id: I475a0655132ecbb40b1eac919309597b2560e71b Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>