Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
\inmodule QtCore More...
#include <qhash.h>
Classes | |
class | const_iterator |
\inmodule QtCore More... | |
class | iterator |
\inmodule QtCore More... | |
class | key_iterator |
\inmodule QtCore More... | |
Public Types | |
using | key_type = Key |
using | mapped_type = T |
using | value_type = T |
using | size_type = qsizetype |
using | difference_type = qsizetype |
using | reference = T & |
using | const_reference = const T & |
typedef QKeyValueIterator< const Key &, const T &, const_iterator > | const_key_value_iterator |
\inmodule QtCore | |
typedef QKeyValueIterator< const Key &, T &, iterator > | key_value_iterator |
\inmodule QtCore | |
typedef iterator | Iterator |
typedef const_iterator | ConstIterator |
Public Member Functions | |
QMultiHash () noexcept=default | |
Constructs an empty hash. | |
QMultiHash (std::initializer_list< std::pair< Key, T > > list) | |
template<typename InputIterator , QtPrivate::IfAssociativeIteratorHasKeyAndValue< InputIterator > = true> | |
QMultiHash (InputIterator f, InputIterator l) | |
template<typename InputIterator , QtPrivate::IfAssociativeIteratorHasFirstAndSecond< InputIterator > = true> | |
QMultiHash (InputIterator f, InputIterator l) | |
QMultiHash (const QMultiHash &other) noexcept | |
~QMultiHash () | |
QMultiHash & | operator= (const QMultiHash &other) noexcept(std::is_nothrow_destructible< Node >::value) |
QMultiHash (QMultiHash &&other) noexcept | |
QMultiHash & | operator= (QMultiHash &&other) noexcept(std::is_nothrow_destructible< Node >::value) |
QMultiHash (const QHash< Key, T > &other) | |
Constructs a copy of other (which can be a QHash or a QMultiHash). | |
QMultiHash (QHash< Key, T > &&other) | |
void | swap (QMultiHash &other) noexcept |
template<typename AKey = Key, typename AT = T> | |
QTypeTraits::compare_eq_result_container< QMultiHash, AKey, AT > | operator== (const QMultiHash &other) const noexcept |
template<typename AKey = Key, typename AT = T> | |
QTypeTraits::compare_eq_result_container< QMultiHash, AKey, AT > | operator!= (const QMultiHash &other) const noexcept |
qsizetype | size () const noexcept |
bool | isEmpty () const noexcept |
qsizetype | capacity () const noexcept |
void | reserve (qsizetype size) |
void | squeeze () |
void | detach () |
bool | isDetached () const noexcept |
bool | isSharedWith (const QMultiHash &other) const noexcept |
void | clear () noexcept(std::is_nothrow_destructible< Node >::value) |
qsizetype | remove (const Key &key) |
template<typename Predicate > | |
qsizetype | removeIf (Predicate pred) |
T | take (const Key &key) |
Removes the item with the key from the hash and returns the value associated with it. | |
bool | contains (const Key &key) const noexcept |
Key | key (const T &value) const noexcept |
Key | key (const T &value, const Key &defaultKey) const noexcept |
T | value (const Key &key) const noexcept |
T | value (const Key &key, const T &defaultValue) const noexcept |
Returns the value associated with the key. | |
T & | operator[] (const Key &key) |
Returns the value associated with the key as a modifiable reference. | |
const T | operator[] (const Key &key) const noexcept |
QList< Key > | uniqueKeys () const |
QList< Key > | keys () const |
Returns a list containing all the keys in the hash, in an arbitrary order. | |
QList< Key > | keys (const T &value) const |
QList< T > | values () const |
Returns a list containing all the values in the hash, in an arbitrary order. | |
QList< T > | values (const Key &key) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a list of all the values associated with the key, from the most recently inserted to the least recently inserted. | |
iterator | begin () |
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash. | |
const_iterator | begin () const noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const_iterator | cbegin () const noexcept |
const_iterator | constBegin () const noexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash. | |
iterator | end () noexcept |
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the hash. | |
const_iterator | end () const noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const_iterator | cend () const noexcept |
const_iterator | constEnd () const noexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the hash. | |
key_iterator | keyBegin () const noexcept |
key_iterator | keyEnd () const noexcept |
key_value_iterator | keyValueBegin () noexcept |
key_value_iterator | keyValueEnd () noexcept |
const_key_value_iterator | keyValueBegin () const noexcept |
const_key_value_iterator | constKeyValueBegin () const noexcept |
const_key_value_iterator | keyValueEnd () const noexcept |
const_key_value_iterator | constKeyValueEnd () const noexcept |
auto | asKeyValueRange () & |
auto | asKeyValueRange () const & |
auto | asKeyValueRange () && |
auto | asKeyValueRange () const && |
iterator | detach (const_iterator it) |
iterator | erase (const_iterator it) |
qsizetype | count () const noexcept |
iterator | find (const Key &key) |
const_iterator | constFind (const Key &key) const noexcept |
const_iterator | find (const Key &key) const noexcept |
iterator | insert (const Key &key, const T &value) |
Inserts a new item with the key and a value of value. | |
template<typename ... Args> | |
iterator | emplace (const Key &key, Args &&... args) |
template<typename ... Args> | |
iterator | emplace (Key &&key, Args &&... args) |
Inserts a new element into the container. | |
float | load_factor () const noexcept |
size_t | bucket_count () const noexcept |
bool | empty () const noexcept |
iterator | replace (const Key &key, const T &value) |
Inserts a new item with the key and a value of value. | |
template<typename ... Args> | |
iterator | emplaceReplace (const Key &key, Args &&... args) |
template<typename ... Args> | |
iterator | emplaceReplace (Key &&key, Args &&... args) |
Inserts a new element into the container. | |
QMultiHash & | operator+= (const QMultiHash &other) |
Inserts all the items in the other hash into this hash and returns a reference to this hash. | |
QMultiHash | operator+ (const QMultiHash &other) const |
Returns a hash that contains all the items in this hash in addition to all the items in other. | |
bool | contains (const Key &key, const T &value) const noexcept |
qsizetype | remove (const Key &key, const T &value) |
qsizetype | count (const Key &key) const noexcept |
qsizetype | count (const Key &key, const T &value) const noexcept |
iterator | find (const Key &key, const T &value) |
const_iterator | constFind (const Key &key, const T &value) const noexcept |
const_iterator | find (const Key &key, const T &value) const noexcept |
QMultiHash & | unite (const QMultiHash &other) |
QMultiHash & | unite (const QHash< Key, T > &other) |
QMultiHash & | unite (QHash< Key, T > &&other) |
std::pair< iterator, iterator > | equal_range (const Key &key) |
std::pair< const_iterator, const_iterator > | equal_range (const Key &key) const noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Static Public Member Functions | |
static float | max_load_factor () noexcept |
static size_t | max_bucket_count () noexcept |
Friends | |
class | iterator |
class | const_iterator |
Related Symbols | |
(Note that these are not member symbols.) | |
template< class Key, class T > QDataStream & | operator<< (QDataStream &out, const QMultiHash< Key, T > &hash) |
Writes the hash hash to stream out. | |
template< class Key, class T > QDataStream & | operator>> (QDataStream &in, QMultiHash< Key, T > &hash) |
Reads a hash from stream in into hash. | |
template< class Key, class T > size_t | qHash (const QMultiHash< Key, T > &key, size_t seed=0) |
template< typename Key, typename T, typename Predicate > qsizetype | erase_if (QMultiHash< Key, T > &hash, Predicate pred) |
\inmodule QtCore
The QMultiHash class is a convenience QHash subclass that provides multi-valued hashes.
\reentrant
QMultiHash<Key, T> is one of Qt's generic \l{container classes}. It inherits QHash and extends it with a few convenience functions that make it more suitable than QHash for storing multi-valued hashes. A multi-valued hash is a hash that allows multiple values with the same key.
QMultiHash mostly mirrors QHash's API. For example, you can use isEmpty() to test whether the hash is empty, and you can traverse a QMultiHash using QHash's iterator classes (for example, QHashIterator). But opposed to QHash, it provides an insert() function that allows the insertion of multiple items with the same key. The replace() function corresponds to QHash::insert(). It also provides convenient operator+() and operator+=().
Unlike QMultiMap, QMultiHash does not provide and ordering of the inserted items. The only guarantee is that items that share the same key will appear consecutively, from the most recently to the least recently inserted value.
Example:
Unlike QHash, QMultiHash provides no operator[]. Use value() or replace() if you want to access the most recently inserted item with a certain key.
If you want to retrieve all the values for a single key, you can use values(const Key &key), which returns a QList<T>:
The items that share the same key are available from most recently to least recently inserted.
A more efficient approach is to call find() to get the STL-style iterator for the first item with a key and iterate from there:
QMultiHash's key and value data types must be \l{assignable data types}. You cannot, for example, store a QWidget as a value; instead, store a QWidget *. In addition, QMultiHash's key type must provide operator==(), and there must also be a qHash() function in the type's namespace that returns a hash value for an argument of the key's type. See the QHash documentation for details.
QMultiHash< Key, T >::const_key_value_iterator |
\inmodule QtCore
The QMap::const_key_value_iterator typedef provides an STL-style const iterator for QMultiHash and QMultiHash.
QMultiHash::const_key_value_iterator is essentially the same as QMultiHash::const_iterator with the difference that operator*() returns a key/value pair instead of a value.
using QMultiHash< Key, T >::const_reference = const T & |
typedef const_iterator QMultiHash< Key, T >::ConstIterator |
using QMultiHash< Key, T >::difference_type = qsizetype |
typedef iterator QMultiHash< Key, T >::Iterator |
using QMultiHash< Key, T >::key_type = Key |
QMultiHash< Key, T >::key_value_iterator |
\inmodule QtCore
The QMap::key_value_iterator typedef provides an STL-style iterator for QMultiHash and QMultiHash.
QMultiHash::key_value_iterator is essentially the same as QMultiHash::iterator with the difference that operator*() returns a key/value pair instead of a value.
using QMultiHash< Key, T >::mapped_type = T |
using QMultiHash< Key, T >::reference = T & |
using QMultiHash< Key, T >::size_type = qsizetype |
using QMultiHash< Key, T >::value_type = T |
|
defaultnoexcept |
Constructs an empty hash.
|
inline |
Constructs a multi-hash with a copy of each of the elements in the initializer list list.
Definition at line 1443 of file qhash.h.
References QList< T >::begin(), QMultiHash< Key, T >::const_iterator, QList< T >::end(), QMultiHash< Key, T >::insert(), it, and list.
|
inline |
Constructs a multi-hash with a copy of each of the elements in the iterator range [begin, end). Either the elements iterated by the range must be objects with {first} and
{second} data members (like
{std::pair}), convertible to
Key
and to T
respectively; or the iterators must have {key()} and
{value()} member functions, returning a key convertible to
Key
and a value convertible to T
respectively.
Definition at line 1454 of file qhash.h.
References QMultiHash< Key, T >::insert(), and QtPrivate::reserveIfForwardIterator().
|
inline |
Definition at line 1462 of file qhash.h.
References QMultiHash< Key, T >::insert(), and QtPrivate::reserveIfForwardIterator().
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlineexplicit |
Constructs a copy of other (which can be a QHash or a QMultiHash).
|
inlineexplicit |
Definition at line 1513 of file qhash.h.
References other(), and QMultiHash< Key, T >::unite().
|
inline |
Definition at line 1934 of file qhash.h.
References QtPrivate::QKeyValueRange().
|
inline |
Definition at line 1936 of file qhash.h.
References QtPrivate::QKeyValueRange().
|
inline |
Definition at line 1935 of file qhash.h.
References QtPrivate::QKeyValueRange().
|
inline |
Definition at line 1937 of file qhash.h.
References QtPrivate::QKeyValueRange().
|
inline |
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1918 of file qhash.h.
References d, QMultiHash< Key, T >::detach(), and QMultiHash< Key, T >::iterator.
Referenced by QGradientCache::addCacheElement(), QQuickItemViewPrivate::applyModelChanges(), QMultiHash< Key, T >::constKeyValueBegin(), QDomNamedNodeMapPrivate::item(), QMultiHash< Key, T >::keyBegin(), QMultiHash< Key, T >::keys(), QMultiHash< Key, T >::keyValueBegin(), QMultiHash< Key, T >::keyValueBegin(), QDBusConnectionPrivate::objectDestroyed(), QQmlProfilerServiceImpl::startProfiling(), QQmlProfilerServiceImpl::stopProfiling(), and QMultiHash< Key, T >::values().
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
qhash-iterator-invalidation-func-desc
Definition at line 1919 of file qhash.h.
References QMultiHash< Key, T >::const_iterator, and d.
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 1571 of file qhash.h.
References d.
Referenced by QMultiHash< Key, T >::reserve().
|
inlinenoexcept |
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1924 of file qhash.h.
References QMultiHash< Key, T >::const_iterator.
|
inlinenoexcept |
Removes all items from the hash and frees up all memory used by it.
Definition at line 1588 of file qhash.h.
References d.
Referenced by QOpenGL2GradientCache::~QOpenGL2GradientCache(), QQuickItemViewPrivate::applyModelChanges(), QTextFormatCollection::clear(), QDomNamedNodeMapPrivate::clearMap(), QOpenGL2GradientCache::invalidateResource(), QTextDocumentLayoutPrivate::layoutTable(), and QQuickItemViewChangeSet::reset().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1921 of file qhash.h.
References QMultiHash< Key, T >::const_iterator, and d.
Referenced by QDomNamedNodeMapPrivate::clearMap(), QDomNamedNodeMapPrivate::clone(), QDomNamedNodeMapPrivate::namedItemNS(), resourceDataFileMapRecursion(), and QDomDocumentTypePrivate::save().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1925 of file qhash.h.
References QMultiHash< Key, T >::const_iterator.
Referenced by QDomNamedNodeMapPrivate::clearMap(), QDomNamedNodeMapPrivate::clone(), QGradientCache::getBuffer(), QOpenGL2GradientCache::getBuffer(), QTextFormatCollection::hasFormatCached(), QQmlQmldirData::importLocation(), QTextFormatCollection::indexForFormat(), QDomNamedNodeMapPrivate::namedItemNS(), resourceDataFileMapRecursion(), QDomDocumentTypePrivate::save(), QDBusConnectionPrivate::socketRead(), QDBusConnectionPrivate::socketWrite(), and QQmlJSTypePropagator::startInstruction().
|
inlinenoexcept |
Definition at line 2025 of file qhash.h.
Referenced by QMultiHash< Key, T >::find(), QGradientCache::getBuffer(), QOpenGL2GradientCache::getBuffer(), QTextFormatCollection::hasFormatCached(), QQmlQmldirData::importLocation(), QTextFormatCollection::indexForFormat(), QDBusConnectionPrivate::socketRead(), QDBusConnectionPrivate::socketWrite(), and QQmlJSTypePropagator::startInstruction().
|
inlinenoexcept |
Returns an iterator pointing to the item with the key and the value in the hash.
If the hash contains no such item, the function returns constEnd().
qhash-iterator-invalidation-func-desc
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first entry in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1931 of file qhash.h.
References QMultiHash< Key, T >::begin().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary entry after the last entry in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1933 of file qhash.h.
References QMultiHash< Key, T >::end().
|
inlinenoexcept |
Definition at line 1658 of file qhash.h.
References d.
Referenced by QDomNamedNodeMapPrivate::contains(), QQmlPartsModel::destroyingPackage(), QQmlJSImportVisitor::endVisit(), QQmlJSScope::hasOwnPropertyBindings(), QQmlJSImportVisitor::visit(), QQmlJSImportVisitor::visit(), and QQmlJSImportVisitor::visit().
|
inlinenoexcept |
Returns true
if the hash contains an item with the key and value; otherwise returns false
.
|
inlinenoexcept |
Definition at line 1995 of file qhash.h.
References QMultiHash< Key, T >::size().
|
inline |
Definition at line 1584 of file qhash.h.
References d, and QHashPrivate::Data< Node >::detached().
Referenced by QMultiHash< Key, T >::begin(), QMultiHash< Key, T >::emplace(), QMultiHash< Key, T >::emplaceReplace(), QMultiHash< Key, T >::erase(), and QMultiHash< Key, T >::unite().
|
inline |
Definition at line 1939 of file qhash.h.
References d, i, it, QMultiHash< Key, T >::iterator, QHashPrivate::MultiNodeChain< T >::next, Q_ASSERT, and QHashPrivate::MultiNodeChain< T >::value.
|
inline |
Definition at line 2040 of file qhash.h.
References args, QMultiHash< Key, T >::emplace(), and Key.
Referenced by QMultiHash< Key, T >::emplace(), QMultiHash< Key, T >::insert(), and QMultiHash< Key, T >::unite().
|
inline |
Inserts a new element into the container.
This new element is constructed in-place using args as the arguments for its construction.
If there is already an item with the same key in the hash, this function will simply create a new one. (This behavior is different from replace(), which overwrites the value of an existing item.)
Returns an iterator pointing to the new element.
qhash-iterator-invalidation-func-desc
Definition at line 2046 of file qhash.h.
References args, copy(), d, QMultiHash< Key, T >::detach(), and QMultiHash< Key, T >::isDetached().
|
inline |
Definition at line 2073 of file qhash.h.
References args, QMultiHash< Key, T >::emplaceReplace(), and Key.
Referenced by QMultiHash< Key, T >::emplaceReplace(), and QMultiHash< Key, T >::replace().
|
inline |
Inserts a new element into the container.
This new element is constructed in-place using args as the arguments for its construction.
If there is already an item with the same key in the hash, that item's value is replaced with a value constructed from args.
Returns an iterator pointing to the new element.
qhash-iterator-invalidation-func-desc
Definition at line 2079 of file qhash.h.
References args, copy(), d, QMultiHash< Key, T >::detach(), and QMultiHash< Key, T >::isDetached().
|
inlinenoexcept |
Definition at line 2065 of file qhash.h.
References QMultiHash< Key, T >::isEmpty().
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1923 of file qhash.h.
References QMultiHash< Key, T >::const_iterator.
|
inlinenoexcept |
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last item in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1922 of file qhash.h.
References QMultiHash< Key, T >::iterator.
Referenced by QQuickItemViewPrivate::applyModelChanges(), QMultiHash< Key, T >::constKeyValueEnd(), QQmlPartsModel::indexOf(), QAbstractItemModelPrivate::Persistent::insertMultiAtEnd(), QMultiHash< Key, T >::keyEnd(), QMultiHash< Key, T >::keys(), QMultiHash< Key, T >::keyValueEnd(), QMultiHash< Key, T >::keyValueEnd(), QDomNamedNodeMapPrivate::namedItem(), QDBusConnectionPrivate::objectDestroyed(), QQmlPartsModel::release(), QInotifyFileSystemWatcherEngine::removePaths(), QQmlImportInstance::resolveType(), QQmlProfilerServiceImpl::startProfiling(), QQmlProfilerServiceImpl::stopProfiling(), QMultiHash< Key, T >::unite(), and QMultiHash< Key, T >::values().
|
inline |
Returns a pair of iterators delimiting the range of values {[first, second)}, that are stored under key. If the range is empty then both iterators will be equal to end().
qhash-iterator-invalidation-func-desc
Definition at line 2266 of file qhash.h.
Referenced by QQmlJSScope::addOwnPropertyBinding(), QtQuickPrivate::beginDeferred(), VarBindingTypeValidatorPass::onBinding(), AttachedPropertyReuse::onRead(), QQmlJSScope::ownPropertyBindings(), QQmlJSScope::ownPropertyBindingsInQmlIROrder(), QQmlMetaType::qmlType(), and QInotifyFileSystemWatcherEngine::removePaths().
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
qhash-iterator-invalidation-func-desc
|
inline |
Definition at line 1965 of file qhash.h.
References d, QMultiHash< Key, T >::detach(), i, QHashPrivate::Data< Node >::Bucket::isUnused(), it, iter, QMultiHash< Key, T >::iterator, QHashPrivate::MultiNodeChain< T >::next, next, Q_ASSERT, QHashPrivate::Data< Node >::Bucket::toBucketIndex(), and QHashPrivate::Data< Node >::Bucket::toIterator().
Referenced by QGradientCache::addCacheElement(), and QInotifyFileSystemWatcherEngine::removePaths().
|
inline |
Definition at line 2021 of file qhash.h.
Referenced by QQmlPartsModel::indexOf(), QDomNamedNodeMapPrivate::namedItem(), QQmlPartsModel::release(), and QQmlImportInstance::resolveType().
|
inlinenoexcept |
|
inline |
Returns an iterator pointing to the item with the key and value. If the hash contains no such item, the function returns end().
If the hash contains multiple items with the key and value, the iterator returned points to the most recently inserted item.
qhash-iterator-invalidation-func-desc
|
inlinenoexcept |
qhash-iterator-invalidation-func-desc
Definition at line 2226 of file qhash.h.
References QMultiHash< Key, T >::constFind().
|
inline |
Inserts a new item with the key and a value of value.
If there is already an item with the same key in the hash, this function will simply create a new one. (This behavior is different from replace(), which overwrites the value of an existing item.)
Returns an iterator pointing to the new element.
qhash-iterator-invalidation-func-desc
Definition at line 2034 of file qhash.h.
References QMultiHash< Key, T >::emplace().
Referenced by QDomDocumentTypePrivate::QDomDocumentTypePrivate(), QMultiHash< Key, T >::QMultiHash(), QMultiHash< Key, T >::QMultiHash(), QGradientCache::addCacheElement(), QQmlJSScope::addOwnPropertyBinding(), QInotifyFileSystemWatcherEngine::addPaths(), QTextFormatCollection::indexForFormat(), QDomDocumentTypePrivate::insertAfter(), QDomDocumentTypePrivate::insertBefore(), QAbstractItemModelPrivate::Persistent::insertMultiAtEnd(), QTextDocumentLayoutPrivate::layoutTable(), QQmlPartsModel::object(), AttachedPropertyReuse::onRead(), QQmlMetaType::registerMetaObjectForType(), QQuickItemViewPrivate::removeItem(), QDomDocumentTypePrivate::replaceChild(), QDBusConnectionPrivate::setConnection(), QDomNamedNodeMapPrivate::setNamedItem(), QDomNamedNodeMapPrivate::setNamedItemNS(), QQmlQmldirData::setPriority(), QMultiHash< Key, T >::unite(), and QMultiHash< Key, T >::unite().
|
inlinenoexcept |
Definition at line 1585 of file qhash.h.
References d.
Referenced by QMultiHash< Key, T >::emplace(), QMultiHash< Key, T >::emplaceReplace(), and QMultiHash< Key, T >::reserve().
|
inlinenoexcept |
Definition at line 1569 of file qhash.h.
Referenced by QMultiHash< Key, T >::empty(), QTextDocumentLayoutPrivate::hitTest(), QDomElementPrivate::save(), and QMultiHash< Key, T >::unite().
|
inlinenoexcept |
|
inlinenoexcept |
Returns the first key mapped to value. If the hash contains no item mapped to value, returns defaultKey, or a \l{default-constructed value}{default-constructed key} if this parameter has not been supplied.
This function can be slow (\l{linear time}), because QMultiHash's internal data structure is optimized for fast lookup by key, not by value.
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first key in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1926 of file qhash.h.
References QMultiHash< Key, T >::begin().
Referenced by QMultiHash< Key, T >::keys(), and QQmlProfilerServiceImpl::stateAboutToBeChanged().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last key in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1927 of file qhash.h.
References QMultiHash< Key, T >::end().
Referenced by QMultiHash< Key, T >::keys(), and QQmlProfilerServiceImpl::stateAboutToBeChanged().
|
inline |
Returns a list containing all the keys in the hash, in an arbitrary order.
Keys that occur multiple times in the hash also occur multiple times in the list.
The order is guaranteed to be the same as that used by values().
This function creates a new list, in \l {linear time}. The time and memory use that entails can be avoided by iterating from \l keyBegin() to \l keyEnd().
Definition at line 1749 of file qhash.h.
References QMultiHash< Key, T >::keyBegin(), and QMultiHash< Key, T >::keyEnd().
|
inline |
Definition at line 1750 of file qhash.h.
References QMultiHash< Key, T >::begin(), QMultiHash< Key, T >::end(), and i.
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first entry in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1930 of file qhash.h.
References QMultiHash< Key, T >::begin().
|
inlinenoexcept |
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first entry in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1928 of file qhash.h.
References QMultiHash< Key, T >::begin().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary entry after the last entry in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1932 of file qhash.h.
References QMultiHash< Key, T >::end().
|
inlinenoexcept |
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary entry after the last entry in the hash.
qhash-iterator-invalidation-func-desc
Definition at line 1929 of file qhash.h.
References QMultiHash< Key, T >::end().
|
inlinenoexcept |
|
inlinestaticnoexcept |
Definition at line 2063 of file qhash.h.
References QHashPrivate::Data< Node >::maxNumBuckets().
|
inlinestaticnoexcept |
|
inlinenoexcept |
|
inline |
Returns a hash that contains all the items in this hash in addition to all the items in other.
If a key is common to both hashes, the resulting hash will contain the key multiple times.
Definition at line 2094 of file qhash.h.
References other().
|
inline |
Inserts all the items in the other hash into this hash and returns a reference to this hash.
Definition at line 2092 of file qhash.h.
References QMultiHash< Key, T >::unite().
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 1502 of file qhash.h.
References other(), and QMultiHash< Key, T >::swap().
|
inlinenoexcept |
Definition at line 1526 of file qhash.h.
References d, it, QHashPrivate::MultiNodeChain< T >::next, other(), Q_ASSERT, and QHashPrivate::MultiNodeChain< T >::value.
|
inline |
Returns the value associated with the key as a modifiable reference.
If the hash contains no item with the key, the function inserts a \l{default-constructed value} into the hash with the key, and returns a reference to it.
If the hash contains multiple items with the key, this function returns a reference to the most recently inserted value.
qhash-iterator-invalidation-func-desc
|
inlinenoexcept |
|
inline |
Removes all the items that have the key from the hash. Returns the number of items removed.
Definition at line 1596 of file qhash.h.
Referenced by QQmlProfilerServiceImpl::engineRemoved(), QDomDocumentTypePrivate::removeChild(), QDomNamedNodeMapPrivate::removeNamedItem(), and QDomDocumentTypePrivate::replaceChild().
|
inline |
Removes all elements for which the predicate pred returns true from the multi hash.
The function supports predicates which take either an argument of type {QMultiHash<Key, T>::iterator}, or an argument of type
{std::pair<const Key &, T &>}.
Returns the number of elements removed, if any.
Definition at line 1621 of file qhash.h.
References QtPrivate::associative_erase_if().
|
inline |
Inserts a new item with the key and a value of value.
If there is already an item with the key, that item's value is replaced with value.
If there are multiple items with the key, the most recently inserted item's value is replaced with value.
Returns an iterator pointing to the new/updated element.
qhash-iterator-invalidation-func-desc
Definition at line 2067 of file qhash.h.
References QMultiHash< Key, T >::emplaceReplace().
Referenced by QQuickItemViewPrivate::removeItem().
|
inline |
Definition at line 1572 of file qhash.h.
References QMultiHash< Key, T >::capacity(), d, QHashPrivate::Data< Node >::detached(), and QMultiHash< Key, T >::isDetached().
Referenced by QMultiHash< Key, T >::squeeze().
|
inlinenoexcept |
Definition at line 1567 of file qhash.h.
Referenced by QGradientCache::addCacheElement(), QQmlJSScope::addOwnPropertyBinding(), QMultiHash< Key, T >::count(), QDomNamedNodeMapPrivate::length(), QDomElementPrivate::save(), and RCCFileInfo::writeDataInfo().
|
inline |
Definition at line 1582 of file qhash.h.
References QMultiHash< Key, T >::reserve().
|
inlinenoexcept |
Swaps hash other with this hash. This operation is very fast and never fails.
Definition at line 1518 of file qhash.h.
References d, other(), and qt_ptr_swap().
Referenced by QMultiHash< Key, T >::operator=().
|
inline |
Removes the item with the key from the hash and returns the value associated with it.
If the item does not exist in the hash, the function simply returns a \l{default-constructed value}. If there are multiple items for key in the hash, only the most recently inserted one is removed.
If you don't use the return value, remove() is more efficient.
Definition at line 1626 of file qhash.h.
Referenced by QQuickGridViewPrivate::applyInsertionChange(), and QQuickListViewPrivate::applyInsertionChange().
|
inline |
Inserts all the items in the other hash into this hash and returns a reference to this hash.
Definition at line 2246 of file qhash.h.
References QMultiHash< Key, T >::insert(), and other().
|
inline |
Inserts all the items in the other hash into this hash and returns a reference to this hash.
Definition at line 2231 of file qhash.h.
References copy(), QMultiHash< Key, T >::detach(), QMultiHash< Key, T >::insert(), QMultiHash< Key, T >::isEmpty(), and other().
Referenced by QMultiHash< Key, T >::QMultiHash(), QMultiHash< Key, T >::operator+=(), and QMultiHash< Key, T >::unite().
|
inline |
Definition at line 2253 of file qhash.h.
References QMultiHash< Key, T >::emplace(), QMultiHash< Key, T >::end(), it, other(), and QMultiHash< Key, T >::unite().
|
inlinenoexcept |
Definition at line 1703 of file qhash.h.
Referenced by QDomNamedNodeMapPrivate::setNamedItem().
|
inlinenoexcept |
Returns the value associated with the key.
If the hash contains no item with the key, the function returns defaultValue, or a \l{default-constructed value} if this parameter has not been supplied.
If there are multiple items for the key in the hash, the value of the most recently inserted one is returned.
|
inline |
Returns a list containing all the values in the hash, in an arbitrary order.
If a key is associated with multiple values, all of its values will be in the list, and not just the most recently inserted one.
The order is guaranteed to be the same as that used by keys().
This function creates a new list, in \l {linear time}. The time and memory use that entails can be avoided by iterating from \l keyValueBegin() to \l keyValueEnd().
Definition at line 1762 of file qhash.h.
References QMultiHash< Key, T >::begin(), and QMultiHash< Key, T >::end().
Referenced by QTextDocumentLayoutPrivate::drawTableCell(), QQmlJSImportVisitor::endVisit(), QTextDocumentLayoutPrivate::hitTest(), and QTextDocumentLayoutPrivate::layoutCell().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a list of all the values associated with the key, from the most recently inserted to the least recently inserted.
|
friend |
Definition at line 1888 of file qhash.h.
Referenced by QMultiHash< Key, T >::QMultiHash(), QMultiHash< Key, T >::begin(), QMultiHash< Key, T >::cbegin(), QMultiHash< Key, T >::cend(), QMultiHash< Key, T >::constBegin(), QMultiHash< Key, T >::constEnd(), and QMultiHash< Key, T >::end().
|
related |
Removes all elements for which the predicate pred returns true from the multi hash hash.
The function supports predicates which take either an argument of type {QMultiHash<Key, T>::iterator}, or an argument of type
{std::pair<const Key &, T &>}.
Returns the number of elements removed, if any.
Definition at line 2465 of file qhash.h.
References QtPrivate::associative_erase_if(), and hash.
|
friend |
Definition at line 1837 of file qhash.h.
Referenced by QMultiHash< Key, T >::begin(), QMultiHash< Key, T >::detach(), QMultiHash< Key, T >::end(), and QMultiHash< Key, T >::erase().
|
related |
Writes the hash hash to stream out.
This function requires the key and value types to implement operator<<()
.
Definition at line 578 of file qdatastream.h.
References hash, and QtPrivate::readAssociativeContainer().
|
related |
Reads a hash from stream in into hash.
This function requires the key and value types to implement operator>>()
.
Definition at line 578 of file qdatastream.h.
|
related |