summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qmultimap.qdoc
Commit message (Collapse)AuthorAgeFilesLines
* Change license of .qdoc filesLucie Gérard2024-02-021-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all .qdoc files should be LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I7c4d8a1957db6f6d7ad18cbc1928499724e9305f Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QMap/QHash: s/QPair/std::pair/Marc Mutz2023-12-131-2/+2
| | | | | | | | | Also port from qMakePair to just braced initialization using CTAD. Task-number: QTBUG-115841 Pick-to: 6.7 Change-Id: Ib0ad55d7110521e34004dc9050022f9c0046722e Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QMap/MultiMap/Hash/MultiHash: synchronize documentationChristian Ehrlicher2023-10-041-0/+6
| | | | | | | | | | | Synchronize the documentation of the four container classes: - document the return type of insert() and replace() - don't reference QMultiHash/Map from QHash/Map except in the details paragraph Task-number: QTBUG-117757 Change-Id: I93ee7eec0c298854e05e83a43f1c7cffd0610d72 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Brush up the container code snippetsFriedemann Kleint2023-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | - Bring iterator loops into a consistent form using auto and creating and end variable, use cbegin()/cend() where suitable - Use (std::)endl instead of Qt::endl for iostreams - Fix removed container conversion API (QList::fromSet, QSet::toList()) - Use range-based for instead of foreach - Use initializer lists - Use qPrintable(QString) for output to std::ostream - Use qsizetype - Remove some unused snippets Complements f6b137bdc43d4021cbbe602759dbcced2e04d638. Pick-to: 6.5 Change-Id: I8a167099cdb224f45b984fa834d46269144a7ef0 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtBase/doc: fix examples for QHash/QMap/QMultiMap::erase()Christian Ehrlicher2023-03-311-37/+11
| | | | | | | | | | | | | QHash/MultiHash & QMap/MultiMap::erase() do no longer take an iterator in Qt6. Clean up the examples by only providing one example, the rest is common c++ which should not be handled in the Qt documentation. Also mention erase_if() and remove references to the (soon to be deprecated) Java-style iterators. Pick-to: 6.5 6.2 Fixes: QTBUG-105109 Change-Id: I47b11f3b5dcc173494e5c6f9ad0167c613b12209 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Use \relates for functions in the global scopeTopi Reinio2023-03-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | This addresses the recent warnings introduced by a change to QDoc: qkeysequence.h:32: (qdoc) warning: No documentation generated for function 'qHash' in global scope. qmap.h:1557: (qdoc) warning: No documentation generated for function 'operator+' in global scope. qmap.h:1565: (qdoc) warning: No documentation generated for function 'operator+=' in global scope. qvariant.h:582: (qdoc) warning: No documentation generated for function 'operator>>' in global scope. qvariant.h:590: (qdoc) warning: No documentation generated for function 'operator<<' in global scope. Also, mark qt_win_hasPackageIdentity() declared in qfunctions_win_p.h as \internal. Pick-to: 6.5 Change-Id: Idc9c813370ff3133ac9dc3bf809976b0ece88811 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Format certain operators in textPaul Wicking2022-08-231-12/+12
| | | | | | | | | | Use correct text formatting; this ensures e.g. the decrement operator isn't converted to an en dash in the docs. Apply to increment operator docs also for consistency. Task-number: QTBUG-105729 Change-Id: I5f126b90bc1d1b91d86e1f87c9b17a583841adb6 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Doc: QMap: Add ref-qualifiers to \fn signatures for toStd[Multi]Map()Topi Reinio2022-03-311-1/+1
| | | | | | | | | | Because of a bug in QDoc there was never a warning reported for the missing qualifiers. Pick-to: 6.3 Task-number: QTBUG-101461 Change-Id: Ibb9114bc5d29e75158d2ac254169ba2a73043f0d Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Associative containers: add a way to obtain a key/value rangeGiuseppe D'Angelo2022-03-041-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our associative containers' iterator's value_type isn't a destructurable type (yielding key/value). This means that something like for (auto [k, v] : map) doesn't even compile -- one can only "directly" iterate on the values. For quite some time we've had QKeyValueIterator to allow key/value iteration, but then one had to resort to a "traditional" for loop: for (auto i = map.keyValueBegin(), e = keyValueEnd(); i!=e; ++i) This can be easily packaged in an adaptor class, which is what this commmit does, thereby offering a C++17-compatible way to obtain key/value iteration over associative containers. Something possibly peculiar is the fact that the range so obtained is a range of pairs of references -- not a range of references to pairs. But that's easily explained by the fact that we have no pairs to build references to; hence, for (auto &[k, v] : map.asKeyValueRange()) doesn't compile (lvalue reference doesn't bind to prvalue pair). Instead, both of these compile: for (auto [k, v] : map.asKeyValueRange()) for (auto &&[k, v] : map.asKeyValueRange()) and in *both* cases one gets references to the keys/values in the map. If the map is non-const, the reference to the value is mutable. Last but not least, implement pinning for rvalue containers. [ChangeLog][QtCore][QMap] Added asKeyValueRange(). [ChangeLog][QtCore][QMultiMap] Added asKeyValueRange(). [ChangeLog][QtCore][QHash] Added asKeyValueRange(). [ChangeLog][QtCore][QMultiHash] Added asKeyValueRange(). Task-number: QTBUG-4615 Change-Id: Ic8506bff38b2f753494b21ab76f52e05c06ffc8b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Fix documentation issues for Qt CoreTopi Reinio2021-08-241-16/+20
| | | | | | | | | | | | | | * Tag deprecated Q(Multi)Map operators in the header to correctly match them with documentation \fn commands. * Add documentation for QByteArrayView comparison operators. * Add a dummy typedef 'jfieldID' for generating docs correctly on non-Android platforms * Fix other minor issues Pick-to: 6.2 Task-number: QTBUG-95860 Change-Id: I141d2f75d6aa10557aa374201f09ad74b4cd6e81 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QMap: add operator+ and - for iteratorsGiuseppe D'Angelo2021-07-271-0/+32
| | | | | | | | | | | | | We missed the chance of deprecating them in 5.15, so they'll just add to the pain of porting to 6.0. We should not keep them around forever, though; QMap isn't random access and so its iterators should only have bidirectional APIs. Pick-to: 6.2 Fixes: QTBUG-95334 Change-Id: I3577f7d25e8ab793722d2f220fd27bc85c622b0d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QMultiMap::erase - extend docs to specify iterator limitationsIvan Solovev2021-07-121-0/+4
| | | | | | | | Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: I7cd58e010af5dd59404e37c55f6ebd91c4631b3f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Use \deprecated instead of \obsoletePaul Wicking2021-05-261-5/+5
| | | | | | Task-number: QTBUG-93990 Change-Id: I4e512354a49dde6678ca89cabc56bc76ba666bb3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Improve QMap, QMultiMap descriptionKai Köhne2021-01-061-2/+1
| | | | | | | | | | | | | Make it clear that the fast lookup is by key, not by value. See also discussion in https://forum.qt.io/topic/121907/misleading-documentation-of-qhash-qmap/ Pick-to: 5.15 6.0 Change-Id: I396297e0e4674e0a1f889f4138ab52ff224c0ee2 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Associative containers: add erase_ifGiuseppe D'Angelo2020-12-021-0/+29
| | | | | | | | | | | | | | | | | | | | Use a trick similar to the one we use for their ranged constructors: support predicates that either take a container's iterator, or that take a std::pair (for STL compatibility). [ChangeLog][QtCore][QMap] Added removeIf() and erase_if(). [ChangeLog][QtCore][QMultiMap] Added removeIf() and erase_if(). [ChangeLog][QtCore][QHash] Added removeIf() and erase_if(). [ChangeLog][QtCore][QMultiHash] Added removeIf() and erase_if(). Change-Id: Ie40aadf6217d7a4126a626c390d530812ebcf020 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QMap and QMultiMap comparisons hidden friendsAllan Sandfeld Jensen2020-10-291-4/+2
| | | | | | Task-number: QTBUG-87975 Change-Id: I3c84a188cdbb0d09e0e7c66588c7638c8a8328fd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Consistenly deprecate QMultiMap insert, add moving unite overloadVolker Hilsheimer2020-10-171-1/+13
| | | | | Change-Id: I8d1d30f3962b0444c27591bf45b6b3c538172039 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix qdoc warnings for QMap/QMultiMapVolker Hilsheimer2020-10-011-40/+40
| | | | | | | | | | | | | | | | | | | | | | | | These containers have most of their operators as non-members, except those declared as hidden friends in the iterator classes, which will be fixed in qdoc. QMultiMap doesn't have an operator[] (which might be unintentional). Deprecate QMultiMap::insert/insertMulti APIs, as the documentation suggests that those are just compatibility overloads. Add documentation for the rvalue-overload of QMap/QMultiMap::insert. Note that this overload does not exist for QHash/QMultiHash. Also, it seems from the implementation that the moved-from map is not reset to the empty map if it did share data with another copy. Not addressed: QMap and QMultiMap have the special 5 implicitly generated by the compiler, so these functions are not declared anywhere, which results in qdoc warnings. qdoc could generate the documentation automatically, if it can know that those members exist. Change-Id: I0608b57c8c3793fedd304a4c7b10e607a24ad5f6 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove some deprecation comments from qmap.hEdward Welbourne2020-09-211-1/+5
| | | | | | | | | Lars says documenting that the methods are slow is sufficient, no need to deprecate them. Task-number: QTBUG-85700 Change-Id: I7b1d19e91e30205df7d8198e3704cecc72a853e0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QMultiMap: add constructors from QMapGiuseppe D'Angelo2020-08-101-0/+13
| | | | | | | | | | | We can provide those. They don't lose information, do not have the problem we face at offering ranged constructors (namely the order of duplicate keys), and have a distinct advantage over ranged constructors: a non-shared rvalue QMap can be "upgraded" to a QMultiMap without allocating memory for the multimap. Change-Id: Ic23c83927c05a210bc1f0050006c9f26365d3916 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve QMultiMap docs a bitGiuseppe D'Angelo2020-08-101-1/+8
| | | | | Change-Id: I170dc5de15dac61620aaed94f32226c158092dce Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QMultiMap: add range eraseGiuseppe D'Angelo2020-08-061-0/+11
| | | | | | | | Also remove duplication by centralizing the main code for erase(), and implement erase(pos) in terms of erase(first, last). Change-Id: Ie0272ebac92fd7da48c31f9d68e69a2faa583bbc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Long Live QMap as a refcounted std::map!Giuseppe D'Angelo2020-08-061-0/+1465
... and QMultiMap as std::multimap. Just use the implementation from the STL; we can't really claim that our code is much better than STL's, or does things any differently (de facto they're both red-black trees). Decouple QMultiMap from QMap, by making it NOT inherit from QMap any longer. This completes the deprecation started in 5.15: QMap now does not store duplicated keys any more. Something to establish is where to put the QExplictlySharedDataPointer replcement that is in there as an ad-hoc solution. There's a number of patches in-flight by Marc that try to introduce the same (or very similar) functionality. Miscellanea changes to the Q(Multi)Map code itself: * consistently use size_type instead of int; * pass iterators by value; * drop QT_STRICT_ITERATORS; * iterators implictly convert to const_iterators, and APIs take const_iterators; * iterators are just bidirectional and not random access; * added noexcept where it makes sense; * "inline" dropped (churn); * qMapLessThanKey dropped (undocumented, 0 hits in Qt, 1 hit in KDE); * operator== on Q(Multi)Map requires operator== on the key type (we're checking for equality, not equivalence!). Very few breakages occur in qtbase. [ChangeLog][Potentially Source-Incompatible Changes] QMap does not support multiple equivalent keys any more. Any related functionality has been removed from QMap, following the deprecation that happened in Qt 5.15. Use QMultiMap for this use case. [ChangeLog][Potentially Source-Incompatible Changes] QMap and QMultiMap iterators random-access API have been removed. Note that the iterators have always been just bidirectional; moving an iterator by N positions can still be achieved using std::next or std::advance, at the same cost as before (O(N)). [ChangeLog][Potentially Source-Incompatible Changes] QMultiMap does not inherit from QMap any more. Amongst other things, this means that iterators on a QMultiMap now belong to the QMultiMap class (and not to the QMap class); new Java iterators have been added. Change-Id: I5a0fe9b020f92c21b37065a1defff783b5d2b7a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>