summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qmap.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-181-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
| * docs: State that QMap::equal_range() returns an open-ended intervalSérgio Martins2016-02-121-1/+1
| | | | | | | | | | | | Change-Id: If31dd078aeb92e479db8c1f0a5e58e56b549b5f6 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.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>
* doc: Add a few missing const keywords in \fn commandsMartin Smith2015-08-161-2/+2
| | | | | | | | | This adds "const" to a few \fn commands for new operators in QHash and QMap. Change-Id: I93cf7aaf88fcb4db17de5810b555b978e8119e20 Task-number: QTBUG-47669 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Introduce QMap key iteratorsSérgio Martins2015-07-281-4/+150
| | | | | | | | | | | So we can have interoperability with algorithms. Motivated by inefficient code like qDeleteAll(map.keys()) [ChangeLog][QtCore][QMap] Added key iterators, accessible through keyBegin() and keyEnd(). Change-Id: Ieee2f9ad031e9d1e845a71447746699bbe95b96c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QMap: add const equal_range() overloadMarc Mutz2015-06-191-0/+6
| | | | | | | | | | ... to prevent detaching. [ChangeLog][QtCore][QMap] Added const equal_range() overload. Change-Id: I4b39abb8ad41ba6eaa8f9a9a74ed74ed10337dd3 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Remove Q_NO_USING_KEYWORDThiago Macieira2014-12-201-43/+0
| | | | | | | | | | | | | | | | | | | There's a lot of code now requiring it. Any compiler that doesn't support the keyword is too old for Qt now. The last time anyone asked about this macro was for QTBUG-27393 and we don't know which compiler that was. As a necessity, this patch contains a reversal of a0c3a57aed5cde37017733e7cf5e41cc6a1174aa [ChangeLog][Compiler Specific Changes] Qt 5.5 now unconditionally uses the "using" keyword. Compilers that do not support this keyword are deprecated and will not be able to build Qt. Previous versions of Qt may or may not compile, as no testing was done to ensure it worked. Change-Id: Ief042f34aba555a095d1f342a0ee7ee9feadf42d Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@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>
* Doc: Add missing \since 5.2 to QMap::first/last{,Key}Marcel Krems2013-11-141-0/+6
| | | | | Change-Id: I04b356bfdd2298dccb174ac7cc83d54a3fbcdc02 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* QMap - improve docs a bit (mainly by adding more time complexities)Thorbjørn Martsum2013-10-151-2/+13
| | | | | | Change-Id: I8a361ef09c338bbba228fd774b2bfd938869adc5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve implicit shared documentation a bitThorbjørn Martsum2013-10-151-0/+10
| | | | | | | | Task-number: QTBUG-27061 Change-Id: I66e000a9f59fda3654066013e6e78c3ba6fd27fe Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-18/+18
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Doc: Add docs for rvalue references and move constructorsGeir Vattekar2013-09-271-0/+17
| | | | | | | | | These members were introduced in 4.8, but left undocumented. Because we consider undocumented API to be internal, the members are \since 5.2. Change-Id: I52e2840a8cfaa7f59f410b3e2a06c0942ea06539 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Add first/last accessors to QMapMathias Hasselmann2013-09-081-0/+42
| | | | | | | | | | | | | | | QMap explicitly sorts its entries by key value. For an ordered container it's (often?) useful to access the first or last entry, for instance to quickly compute the next key of the mapping. The first entry is easily accessible by the STL begin() method, but for accessing the last entry pretty ugly iterator arithmetics must be applied: *(end() - 1). With their first() and last() accessors the container classes QList and QVector provide a much nicer method of accessing extrema, so for consistency this syntactical sugar also should be applied to QMap. Change-Id: Ibd544acbad8c3ac16f12a1e74362207ea1694375 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* QMap - add multiInsert with hintThorbjørn Martsum2013-03-061-0/+37
| | | | | | | | This provides a fast multiInsert in QMap (and a fast insert in QMultiMap) when providing a correct hint. Change-Id: I3c864c3a7842765fe63f8ecb4b54d0e8c9fd22d7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMap - add insert overload that provide a hintThorbjørn Lund Martsum2013-03-061-0/+26
| | | | | | | | This adds a fast insert on QMap when providing a correct hint. Change-Id: I256bba342932c1d4f24c6e65074e1bf47b519537 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Added initializer list constructors for Qt associative containers.Roman Pasechnik2013-01-241-0/+20
| | | | | | | | | Affected: QSet, QMap, QMultiMap, QHash, QMultiHash. Task-number: QTBUG-25679 Change-Id: I01f3ecfbca805f4c053a75232188bd2a77fdb1f2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@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>
* QMap 5.0 - keep track of leftmost node (BIC)Thorbjørn Lund Martsum2012-10-271-1/+17
| | | | | | | | | | | | | | | | | | | | | This suggestion keeps track of the most left node. The point is that constBegin() becomes a lot faster. That speeds up iteration a bit, and makes it O(1) to get the first element. The penalty in insert and remove is very small. On large trees it seems to be less than 1%. It should be noticed that constBegin() is a very common hint on my planned change to 5.1, and this opperation will without this patch cost 2 x log N. One when the user calls the hint with begin - and one where it is compared with begin. Other std::maps has a very fast begin(). E.g http://www.cplusplus.com/reference/stl/map/begin/ (begin with constant time) Change-Id: I221f6755aa8bd16a5189771c5bc8ae56c8ee0fb4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Doc: update QMap's description following 5cb036851Pierre Rossi2012-09-271-1/+1
| | | | | Change-Id: I9dccb9f64578cf8c9da50524c5d4d1201ab488bd Reviewed-by: Lars Knoll <lars.knoll@digia.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>
* Remove qUpperBound usages from qtbaseGiuseppe D'Angelo2012-09-191-1/+1
| | | | | | | | | Replace them with std::upper_bound; this allows for deprecation of qUpperBound. Change-Id: Idef01d2228b9a70eee3d52931d7aedb5bb6ba902 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Remove qLowerBound usages from qtbaseGiuseppe D'Angelo2012-09-191-1/+1
| | | | | | | | | Replace them with std::lower_bound; this allows for deprecation of qLowerBound. Change-Id: I536e7338eb85ea6c7c1a5bf23121292767927e0b Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* 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>
* Fix most qdoc errors for QMapLars Knoll2012-08-181-18/+10
| | | | | Change-Id: I8cac3b63cab32c655f722aca467489730c3f0a42 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: remove \link usagesGiuseppe D'Angelo2012-05-291-4/+4
| | | | | Change-Id: I0de764b51a972de0b6eb2bf3c04d2b190f581f52 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-30/+30
| | | | | | | | | | | | 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>
* Rewrite QMap to use a RB treeLars Knoll2012-03-231-158/+287
| | | | | | | | | | | | | | | | | | | | QMap used to use a skiplist in Qt 4.x, which has variable sized nodes and we can thus not optimise using custom allocators. The rewrite now uses a red-black tree, and all allocations and tree operations happen in the cpp file. This will allow us to introduce custom allocation schemes in later versions of Qt. Added some more tests and a benchmark. Memory consumption of the new QMap implementation is pretty much the same as before. Performance of insertion and lookup has increased by 10-30%. iteration is slower, but still extremely fast and should not matter compared to the work usually done when iterating. Change-Id: I8796c0e4b207d01111e2ead7ae55afb464dd88f5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge master into api_changesKent Hansen2012-03-191-1/+19
|\ | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvector.h tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I877256e95f3788e617437f4e9661a88047f38cd6
| * containers: add C++11-style c{begin,end}() as alias for const{Begin,End}()Marc Mutz2012-03-171-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++11 adds cbegin()/cend() functions for the same reason Qt has constBegin()/constEnd(). This patch adds these functions to the Qt containers with the same implementation as constBegin()/constEnd(). It also fixes the return types in the documentation of existing constFind() functions (documentation only). C++11 only adds cbegin()/cend() (and crbegin()/crend(), which Qt doesn't have). In particular, it doesn't add cfind(), so I didn't supply these, even though Qt comes with constFind(). This is a forward-port of https://qt.gitorious.org/qt/qt/merge_requests/1365. Change-Id: Ida086b64246b24e25254eafbcb06c8e33388502b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/api_changes' into containtersJoão Abecasis2012-03-081-3/+3
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
| * Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I519bf9c29b14092e3ab6067612f42bf749eeedf5 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-051-2/+2
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I23d214bf33c2badfae1876da3cc7d6d8f6e635fb
| * Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
| * Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-01-161-4/+4
|\| | | | | | | Change-Id: I2d358b912f1055ee6021d13de2f66fd459aaa355
| * Remove all non-inline of qMalloc/qFree/qRealloc.Robin Burchell2012-01-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | We're trying to deprecate these, so don't use them anymore. The inline uses of these have been left intact, for the moment. Inline code will need to create their own non-inline allocation methods (for future-proofing to allow alterations in how e.g. individual containers allocate) Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
| * Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | | | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* | Retire the generic Q_REFCOUNT_INITIALIZER macroJoão Abecasis2012-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This was only being used to initialize static read-only RefCount instances, where the value is hard-wired to -1. Instead of allowing initialization with arbitrary values (which for a reference count can be error prone) the intent of the macro is made explicit with its replacement Q_REFCOUNT_INITIALIZE_STATIC. Change-Id: I5b0f3f1eb58c3d010e49e9259ff4d06cbab2fd35 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Get rid of assignment operators in RefCountJoão Abecasis2012-01-041-1/+1
|/ | | | | | | | | | | | , and make it strictly a POD struct. Since this operator was only being used to set the initial (owned) value of the reference count, the name of the function introduced here to replace it makes that use case explicit. Change-Id: I2feadd2ac35dcb75ca211471baf5044a5f57cd62 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused QMapData::createData()/node_create() overloads.Robin Burchell2011-12-081-10/+0
| | | | | | | Change-Id: I79010e1ecfdfe579d996db65681ab1559598f3ce Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Make QMapData::shared_null constBradley T. Hughes2011-09-261-4/+4
| | | | | | | | | | Similar to QVector, QByteArray and QString, keep the shared_null in shareable memory and never modify it. Change-Id: I062825684b79f2b01ec7ce65e0cf74f417b760b8 Reviewed-on: http://codereview.qt-project.org/4530 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Doc: Removed documentation for deleted code.David Boddie2011-07-211-48/+0
| | | | | | | Change-Id: Icdbc05decac3dfe3fc18ce073c494e1fce4ea347 Reviewed-on: http://codereview.qt.nokia.com/1824 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: David Boddie
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+1646
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12