QHash< Key, T > Class Template Reference
#include <qcontainerfwd.h>
template<class Key, class T>
class QHash< Key, T >
Definition at line 54 of file qcontainerfwd.h.
|
| QHash () |
|
| QHash (const QHash< Key, T > &other) |
|
| ~QHash () |
|
QHash< Key, T > & | operator= (const QHash< Key, T > &other) |
|
void | swap (QHash< Key, T > &other) |
|
bool | operator== (const QHash< Key, T > &other) const |
|
bool | operator!= (const QHash< Key, T > &other) const |
|
int | size () const |
|
bool | isEmpty () const |
|
int | capacity () const |
|
void | reserve (int size) |
|
void | squeeze () |
|
void | detach () |
|
bool | isDetached () const |
|
void | setSharable (bool sharable) |
|
bool | isSharedWith (const QHash< Key, T > &other) const |
|
void | clear () |
|
int | remove (const Key &key) |
|
T | take (const Key &key) |
|
bool | contains (const Key &key) const |
|
const Key | key (const T &value) const |
|
const Key | key (const T &value, const Key &defaultKey) const |
|
const T | value (const Key &key) const |
|
const T | value (const Key &key, const T &defaultValue) const |
|
T & | operator[] (const Key &key) |
|
const T | operator[] (const Key &key) const |
|
QList< Key > | uniqueKeys () const |
|
QList< Key > | keys () const |
|
QList< Key > | keys (const T &value) const |
|
QList< T > | values () const |
|
QList< T > | values (const Key &key) const |
|
int | count (const Key &key) const |
|
iterator | begin () |
|
const_iterator | begin () const |
|
const_iterator | constBegin () const |
|
iterator | end () |
|
const_iterator | end () const |
|
const_iterator | constEnd () const |
|
iterator | erase (iterator it) |
|
int | count () const |
|
iterator | find (const Key &key) |
|
const_iterator | find (const Key &key) const |
|
const_iterator | constFind (const Key &key) const |
|
iterator | insert (const Key &key, const T &value) |
|
iterator | insertMulti (const Key &key, const T &value) |
|
QHash< Key, T > & | unite (const QHash< Key, T > &other) |
|
bool | empty () const |
|
Definition at line 281 of file qhash.h.
static QHashData shared_null
Q_INLINE_TEMPLATE QHash< Key, T > & operator= |
( |
const QHash< Key, T > & |
other | ) |
|
Definition at line 290 of file qhash.h.
Q_INLINE_TEMPLATE void qSwap(QScopedPointer< T, Cleanup > &p1, QScopedPointer< T, Cleanup > &p2)
Q_OUTOFLINE_TEMPLATE bool operator== |
( |
const QHash< Key, T > & |
other | ) |
const |
Definition at line 898 of file qhash.h.
907 while (it !=
end()) {
908 const Key &akey = it.key();
912 if (it2 == other.
end() || !(it2.key() == akey))
914 if (!QTypeInfo<T>::isDummy && !(it.value() == it2.value()))
918 }
while (it !=
end() && it.
key() == akey);
iterator find(const Key &key)
friend class const_iterator
bool operator!= |
( |
const QHash< Key, T > & |
other | ) |
const |
|
inline |
Definition at line 293 of file qhash.h.
293 {
return !(*
this == other); }
Q_INLINE_TEMPLATE void reserve |
( |
int |
size | ) |
|
Definition at line 303 of file qhash.h.
303 {
if (
d->
ref != 1) detach_helper(); }
bool isDetached |
( |
| ) |
const |
|
inline |
void setSharable |
( |
bool |
sharable | ) |
|
|
inline |
bool isSharedWith |
( |
const QHash< Key, T > & |
other | ) |
const |
|
inline |
Definition at line 306 of file qhash.h.
306 {
return d == other.
d; }
Q_INLINE_TEMPLATE void clear |
( |
| ) |
|
Q_OUTOFLINE_TEMPLATE int remove |
( |
const Key & |
key | ) |
|
Definition at line 784 of file qhash.h.
790 int oldSize =
d->
size;
791 Node **node = findNode(akey);
793 bool deleteNext =
true;
795 Node *next = (*node)->next;
796 deleteNext = (next !=
e && next->key == (*node)->key);
800 }
while (deleteNext);
803 return oldSize -
d->
size;
Q_OUTOFLINE_TEMPLATE T take |
( |
const Key & |
key | ) |
|
Definition at line 807 of file qhash.h.
813 Node **node = findNode(akey);
815 T
t = (*node)->value;
816 Node *next = (*node)->next;
Q_INLINE_TEMPLATE bool contains |
( |
const Key & |
key | ) |
const |
Definition at line 872 of file qhash.h.
874 return *findNode(akey) !=
e;
Q_OUTOFLINE_TEMPLATE const Key key |
( |
const T & |
value | ) |
const |
Definition at line 674 of file qhash.h.
676 return key(avalue,
Key());
const Key key(const T &value) const
Q_OUTOFLINE_TEMPLATE const Key key |
( |
const T & |
value, |
|
|
const Key & |
defaultKey |
|
) |
| const |
Definition at line 680 of file qhash.h.
684 if (i.value() == avalue)
friend class const_iterator
Q_INLINE_TEMPLATE const T value |
( |
const Key & |
key | ) |
const |
Definition at line 606 of file qhash.h.
609 if (
d->
size == 0 || (node = *findNode(akey)) ==
e) {
Q_INLINE_TEMPLATE const T value |
( |
const Key & |
key, |
|
|
const T & |
defaultValue |
|
) |
| const |
Definition at line 617 of file qhash.h.
620 if (
d->
size == 0 || (node = *findNode(akey)) ==
e) {
621 return adefaultValue;
Q_INLINE_TEMPLATE T & operator[] |
( |
const Key & |
key | ) |
|
Definition at line 738 of file qhash.h.
743 Node **node = findNode(akey, &h);
746 node = findNode(akey, &h);
747 return createNode(h, akey, T(), node)->
value;
749 return (*node)->value;
int int int int int int h
Q_INLINE_TEMPLATE const T operator[] |
( |
const Key & |
key | ) |
const |
Definition at line 732 of file qhash.h.
const T value(const Key &key) const
Q_OUTOFLINE_TEMPLATE QList< Key > uniqueKeys |
( |
| ) |
const |
Definition at line 628 of file qhash.h.
635 const Key &aKey = i.key();
639 goto break_out_of_outer_loop;
640 }
while (aKey == i.key());
643 break_out_of_outer_loop:
friend class const_iterator
Q_OUTOFLINE_TEMPLATE QList< Key > keys |
( |
| ) |
const |
Definition at line 648 of file qhash.h.
friend class const_iterator
Q_OUTOFLINE_TEMPLATE QList< Key > keys |
( |
const T & |
value | ) |
const |
Definition at line 661 of file qhash.h.
666 if (i.value() == avalue)
friend class const_iterator
Definition at line 693 of file qhash.h.
friend class const_iterator
Q_OUTOFLINE_TEMPLATE QList< T > values |
( |
const Key & |
key | ) |
const |
Definition at line 706 of file qhash.h.
709 Node *node = *findNode(akey);
713 }
while ((node = node->next) !=
e && node->key == akey);
Q_OUTOFLINE_TEMPLATE int count |
( |
const Key & |
key | ) |
const |
Definition at line 719 of file qhash.h.
722 Node *node = *findNode(akey);
726 }
while ((node = node->next) !=
e && node->key == akey);
Definition at line 465 of file qhash.h.
friend class const_iterator
Definition at line 466 of file qhash.h.
friend class const_iterator
Definition at line 468 of file qhash.h.
friend class const_iterator
Definition at line 469 of file qhash.h.
friend class const_iterator
Definition at line 827 of file qhash.h.
837 while (*node_ptr != node)
838 node_ptr = &(*node_ptr)->next;
839 *node_ptr = node->next;
Q_INLINE_TEMPLATE QHash< Key, T >::iterator find |
( |
const Key & |
key | ) |
|
Definition at line 853 of file qhash.h.
friend class const_iterator
Definition at line 859 of file qhash.h.
friend class const_iterator
Q_INLINE_TEMPLATE QHash< Key, T >::iterator insert |
( |
const Key & |
key, |
|
|
const T & |
value |
|
) |
| |
Definition at line 753 of file qhash.h.
759 Node **node = findNode(akey, &h);
762 node = findNode(akey, &h);
763 return iterator(createNode(h, akey, avalue, node));
766 if (!QTypeInfo<T>::isDummy)
767 (*node)->value = avalue;
int int int int int int h
Q_INLINE_TEMPLATE QHash< Key, T >::iterator insertMulti |
( |
const Key & |
key, |
|
|
const T & |
value |
|
) |
| |
Definition at line 772 of file qhash.h.
779 Node **nextNode = findNode(akey, &h);
780 return iterator(createNode(h, akey, avalue, nextNode));
int int int int int int h
Q_INLINE_TEMPLATE QHash< Key, T > & unite |
( |
const QHash< Key, T > & |
other | ) |
|
Definition at line 556 of file qhash.h.
560 while (it != copy.constBegin()) {
friend class const_iterator
iterator insertMulti(const Key &key, const T &value)
The documentation for this class was generated from the following files: