summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
Commit message (Collapse)AuthorAgeFilesLines
* interpret format argument of QString::sprintf() as UTF-8Oswald Buddenhagen2013-03-121-1/+3
| | | | | | | | | we expect our source code to be utf-8 throughout, so it doesn't make sense to expect the specifier to be latin-1, as that limits the effective charset to ascii. Change-Id: I22335509ba6c5805d8b264cfd01d7f9a4cf7ef76 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-03-051-0/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure qmake/generators/mac/pbuilder_pbx.cpp src/corelib/kernel/qtimerinfo_unix.cpp src/plugins/platforms/cocoa/qcocoabackingstore.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/xcb/qglxintegration.cpp Change-Id: I8d125fe498f5304874e6976b53f588d3e98a66ac
| * Document MSVC-restrictions regarding QStringLiteral.Friedemann Kleint2013-02-281-0/+13
| | | | | | | | | | | | | | | | Task-number: QTBUG-28885 Change-Id: I02eed2b27970ec31479a6c80fbe4c336431e13de Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * Doc: Add the missing \since 5.0Debao Zhang2013-02-251-0/+2
| | | | | | | | | | | | Change-Id: I79f67e18b64efe7d22ed80adbc6f024ef35b3aac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | Fix QString::toUcs4() returns incorrectly resized QVectorKonstantin Ritt2013-02-271-7/+8
| | | | | | | | | | | | | | | | | | ...when the string contains surrogate code points. Task-number: QTBUG-25536 Change-Id: I07251fee641c14f33175678768ddbe551dbe2bb1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QStringRef: Added toInt(), toUInt(), etc... functions to QStringRef.Keith Gardner2013-02-221-0/+319
| | | | | | | | | | | | | | | | | | | | | | Added the following functions to QStringRef: toShort, toUShort, toInt, toUInt, toLong, toULong, toLongLong, toULongLong, toFloat, and toDouble. These functions use the corresponding functions found in QLocale. Updated tst_qstringref.cpp to exercise the new functionality. Change-Id: I38668a0cc7da0c101a62613fd16cb5a98286617f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-02-141-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/concurrent/doc/qtconcurrent.qdocconf src/corelib/doc/qtcore.qdocconf src/corelib/global/qglobal.h src/dbus/doc/qtdbus.qdocconf src/dbus/qdbusmessage.h src/gui/doc/qtgui.qdocconf src/gui/image/qimagereader.cpp src/network/doc/qtnetwork.qdocconf src/opengl/doc/qtopengl.qdocconf src/opengl/qgl.h src/plugins/platforms/windows/qwindowswindow.cpp src/printsupport/doc/qtprintsupport.qdocconf src/sql/doc/qtsql.qdocconf src/testlib/doc/qttestlib.qdocconf src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf src/widgets/doc/qtwidgets.qdocconf src/xml/doc/qtxml.qdocconf Change-Id: Ie9a1fa2cc44bec22a0b942e817a1095ca3414629
| * Fix typo in QString documentation.Mitch Curtis2013-02-061-1/+1
| | | | | | | | | | Change-Id: Ic7ee426e17bb851d948ff5a772559d80ec7fa059 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | QStringRef: Added a trimmed() function.Keith Gardner2013-01-291-0/+31
| | | | | | | | | | | | | | Change-Id: I67c5d10f29f420e0aea95cf32b5d3c17c141899c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QString::contains overload that returns the match resultsGiuseppe D'Angelo2013-01-141-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This convenience overload allows one to write QRegularExpression re1, re2, ...; QRegularExpressionMatch match; QString subject; if (subject.contains(re1, &match)) { // ... } else if (subject.contains(re2, &match)) { // ... } // .. One can then inspect the results of a successful match in each block (as well as extracting the captured substrings, etc.). Change-Id: I0fb8be8b577656e8db994198f8105c26c4fe67b0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Rename QRegularExpression-related feature defs to QT_NO_REGULAREXPRESSIONGiuseppe D'Angelo2013-01-071-10/+16
|/ | | | | | | | | | | | QRegExp and QRegularExpression are totally independent, therefore using two different defines is the right thing to do. Also, document the new define in qfeatures.{txt,h}. Change-Id: Ice4826ea543f4b22f1cc27bf31ed6e043d0c43b0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* QtBase: Doc: Fix links to STL-style iteratorsDavid Schulz2012-12-061-6/+6
| | | | | Change-Id: I2822c2a7e9bfc1949c20ff81e08961f641e961fb Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fix for integer overflow in QString::replaceChristian Strømme2012-10-031-1/+5
| | | | | | | Task-number: QTBUG-22967 Change-Id: I604e6a725d46eab4c4369ebb54e8c9ea1350f492 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix potential breakage in QString.Jędrzej Nowacki2012-09-241-3/+3
| | | | | | | Negation operator ("!") have precedence over bitwise and ("&"). Change-Id: I39e2d99da6eaa4477bbe35a1259f745e05c9841a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QString::append: add (const QChar*, int len) overloadMarc Mutz2012-08-301-0/+18
| | | | | | | | | | | Both insert and replace have this overload, so one reason to add it to append(), too, is consistency. But I can also make good use of this overload in the the new QStringList::join(QChar) overload, so it's actually useful in its own right. Change-Id: Iccd48f9cb84831399e4db7e3e78eba25c0ced30d Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+4
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Simple optimisation in toLocal8Bit(): call codecForLocale once onlyThiago Macieira2012-08-231-6/+9
| | | | | | | | | The function is only slow the first time we call it, but there's no reason we can't do this simple optimisation anyway. Change-Id: Icacbbeb340838b32f5278b76d1860ad22dc9f7b7 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove references to nonexistent QLocale::setDefaultLocale() in docs.Mitch Curtis2012-07-251-1/+1
| | | | | | | | | Should be QLocale::setDefault(). Task-number: QTBUG-23210 Change-Id: I0f5e6cc431f568c9b8c4be1411b7b47835304d0b Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* fix "No such ..." doc error for QString::toHtmlEscapedJeremy Katz2012-07-191-1/+1
| | | | | | | And a minor rephrase. [...] a HTML -> an HTML Change-Id: I49804d009737b58ca3bb43e60dac869e045b5536 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Remove unused static functions from qlogging.cpp, qstring.cpp.Friedemann Kleint2012-06-121-1/+1
| | | | | Change-Id: I4e9642b5e7fb57ac56511ae06af6ce416d0401ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QCollator in QString and remove it from qlocale_icuLars Knoll2012-06-101-7/+4
| | | | | Change-Id: Ic94439943999382f8050668edfb67d3b75ac1df4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor the ICU code for QLocaleLars Knoll2012-06-101-10/+3
| | | | | | | | | | | | | | | | | Clean up the ICU code and make it thread-safe. Add a QIcuData structure to QLocalePrivate, that contains ICU specific data. Link against ICU directly, greatly simplifying the code. Also fix a bug in the locale specific case conversion code that would cause it to fail and fall back to the QString code if the output string was larger than the input. Change-Id: Ie67e5ea14fa204ebc5887d7aaeb1a4f3ecaf8697 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QString("inf").toFloat() return inf instead of zero.Mitch Curtis2012-06-051-2/+10
| | | | | | | | | | | Currently, QString::toFloat() returns 0 (and sets ok to false) if you try to convert "inf". This is because inf is greater than QT_MAX_FLOAT and there is currently no check to handle inf. Task-number: QTBUG-8629 Change-Id: I498daf4a7a6f880f928461fca628fcaf7d1d6d08 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix the confusion caused by the QT_ALWAYS_HAVE_xxx macrosThiago Macieira2012-05-311-4/+4
| | | | | | | | | | | | | | | | | | | | The QT_ALWAYS_HAVE_xxx macros are gone: they were hard to use and not defined properly. It indicated that the compiler was producing code that required that particular instruction set, so we could use it in our code unconditionally. Instead, let's use the GCC-style __SSE2__ and __ARM_NEON__. MSVC does not generate the __SSE2__ macro, so let's do it for the compiler. Also, define __AVX__ and the macros for the technologies leading to it when we manage to detect an /arch:AVX build (currently not possible, see note in the header). ICC and MSVC allow one to use the intrinsics anywhere, but for Qt all uses of the intrinsics are either in specially-built files, protected by runtime checks, or they are unconditional (qstring.cpp). So we only use the intrinsics when the compiler was instructed to generate code for that instruction set anyway. Change-Id: If8382f30422cee0e5831d051b003acf036824abf Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QtCore: remove \link usagesGiuseppe D'Angelo2012-05-291-3/+2
| | | | | Change-Id: I0de764b51a972de0b6eb2bf3c04d2b190f581f52 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Replace `const QLatin1String &` with `QLatin1String` where appropriateKonstantin Ritt2012-05-251-40/+34
| | | | | | | Task-Id: QTBUG-24502 Change-Id: I360dee4dc68c165de0631ce4cf34e76fd873080e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: get rid of public qStringComparisonHelper()Konstantin Ritt2012-05-251-35/+12
| | | | | | | | | | | | Unify all it's overloads into a single private helper functionand use this new helper where possible - so we could optimize all those operators in one step some later (this also fixes `QBytArray("a\0b") < "a"` didn't respect the \0 while operator== handles nul(s) correctly); Add operators <,>,<=,>=(const char*) to QStringRef so that they doesn't create a temporary QString object; Add missing QT_NO_CAST_FROM_ASCII Change-Id: I8b6562a92fdb96e67aadee181f23f823d206f5fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate {QString,QStringRef,QChar}::{to,from}AsciiThiago Macieira2012-05-221-8/+6
| | | | | | | | | | | | Make them call exactly their Latin 1 counterparts. For the QString functions that take a single char, also use fromAscii directly. Change-Id: I87645aba6ab9cde34c1df3cbc3a979fbd9e91f9d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Correct a mistake about non-characters in the documentation.Thiago Macieira2012-05-161-2/+2
| | | | | | | | | | | The Unicode non-characters are 32 characters, from U+FDD0 to U+FDEF. The code matching these comments was fixed in 9327bc87c3abf58bb471693b5448cd78e3db1b46, but the comment wasn't fixed. Change-Id: I5bde0ab9d70c1c6623893de36d31235cbd9fb152 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Doc: Fix \sa usageMarius Storm-Olsen2012-05-111-1/+1
| | | | | | | | | Ensure comma between elements (757 missing), single space and curly- braces around title elements, etc. Change-Id: Id16c3fda7fc47a12a0682f8720214f4990609a97 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Change to/fromAscii to to/fromUtf8 in the QString conversionsThiago Macieira2012-05-111-4/+4
| | | | | | | | | | | This commit matches the previous documentation commit that says that the conversions are applied using to/fromUtf8. Change-Id: I304e4d866ddedac5094fef8500cbeba299a02cb5 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* fix QString::isRightToLeft() for SMP code pointsKonstantin Ritt2012-05-111-1/+9
| | | | | | Change-Id: Ib8afc932d9566df1a8922da9a75b9f9cbbdd321d Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix MSVC warnings about inconsistent DLL linkage.Friedemann Kleint2012-05-071-4/+4
| | | | | Change-Id: I42f817caf212b871cd00f976054381487b238d31 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Change QString's default codec to be UTF-8Thiago Macieira2012-05-071-2/+40
| | | | | | | | | This is a crude change, not the most efficient way. I'll clean up and make it prettier later on, when I've had the chance to optimise the UTF-8 codec too. Change-Id: I78e30e8d3bddf6ad0210c9c4cedb9a7ce63d1a7d Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Merge "Merge remote-tracking branch 'origin/api_changes'" into ↵Lars Knoll2012-05-031-61/+24
|\ | | | | | | refs/staging/master
| * Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-05-031-61/+24
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/gui/kernel/qguiapplication.h src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow.h tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp Change-Id: I62a8805577a7940d4d36bed985eb3e7019d22f2e
| | * Migrate QString over to QArrayDataJoão Abecasis2012-04-241-61/+24
| | | | | | | | | | | | | | | | | | Change-Id: Ieadc60523a2bef61a088920576c65c720b11bfb9 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Remove references to to/fromAscii in QString and QByteArray main docsThiago Macieira2012-05-031-69/+69
|/ / | | | | | | | | | | | | | | | | | | | | | | Those functions are about to be deprecated and shouldn't be referred to in the main documentation. Since they were temporarily changed to mean UTF-8, this is not a behaviour change. The next commit will update the code to match the documentation. Change-Id: Ia8c2843c7f2b478f5691fe0224d5e631d94b1af6 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | workaround issue where casing diff overflows signed shortKonstantin Ritt2012-04-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there are two such codepoints were added in the Unicode 5.1: U+1D79 LATIN SMALL LETTER INSULAR G U+A77D LATIN CAPITAL LETTER INSULAR G two more of them were added in the Unicode 6.0: U+0265 LATIN SMALL LETTER TURNED H U+A78D LATIN CAPITAL LETTER TURNED H and two more were added in the Unicode 6.1: U+0266 LATIN SMALL LETTER H WITH HOOK U+A7AA LATIN CAPITAL LETTER H WITH HOOK we map them like special cases with length == 1 (note: all are in BMP which is checked explicitly in the generator) Change-Id: I8a34164eb3ee2e575b7799cc12d4b96ad5bcd9c6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | QLocale: Clean up QLocalePrivate implementationJohn Layt2012-04-241-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt4 QLocalePrivate is a struct returned by a d() method. This will be unsuitable for the planned change to use ICU and may cause BIC issues. This change makes QLocalePrivate a class and creates a new struct QLocaleData to hold the data index. Further clean-ups are possible but are left for later. Change-Id: Ie316a07790f74674a3b520b735dff72695cc4060 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-132/+130
|/ | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Merge "Merge remote-tracking branch 'origin/master' into api_changes" into ↵Sergio Ahumada2012-04-171-2/+2
|\ | | | | | | refs/staging/api_changes
| * Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-161-2/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
| | * minor improvement for NormalizationCorrectionsKonstantin Ritt2012-04-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | let's don't hardcode the latests affected version value and simply use the one parsed from NormalizationCorrections.txt Change-Id: I37021e8238d77deada4c5ba7a2d160c87186b9dd Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | | Make QByteArray and QString keep track of terminating nullJoão Abecasis2012-04-161-17/+18
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In conceptual terms, this change increments the Data::alloc member by one for all strings allocated and maintained by these classes. Instances initialized with fromRawData retain 0 as the member value, so they are treated as immutable. This brings QByteArray and QString closer to QVector, making it possible for them to reference and share the same data in memory, in the future. It also brings them closer to QArrayData. In practical terms all comparisons to the alloc member were changed to take into account that it also tracks the terminating null character. Aside from the increment in the alloc member, there should be no user visible changes. Change-Id: I618f49022a9b1845754500c8f8706c72a68b9c7d Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | unite QString::normalized() overloadsKonstantin Ritt2012-04-111-24/+11
| | | | | | | | | | Change-Id: I27545e599a1831728e491a9fad1e52fa255535fc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* | Make reallocData() take (unsigned) size, including nullJoão Abecasis2012-04-111-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | The parameter represents an allocation size and unsigned matches the Q*Data::alloc member it ultimately represents (even if they currently differ in accounting for the null). There's still work up for grabs to ensure we avoid integer overflows when growing. Change-Id: Ib092fec37ec2ceed37bebfdc52e2de27b336328f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>