#include <qhash.h>

Classes |
|
| class | const_iterator |
| class | iterator |
Public Types |
|
| typedef iterator | Iterator |
| typedef const_iterator | ConstIterator |
| typedef T | mapped_type |
| typedef Key | key_type |
| typedef qptrdiff | difference_type |
| typedef int | size_type |
Public Member Functions |
|
| QHash () | |
| QHash (const QHash< Key, T > &other) | |
| ~QHash () | |
| QHash< Key, T > & | operator= (const 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 |
Friends |
|
| class | iterator |
| class | const_iterator |
| typedef const_iterator ConstIterator |
| typedef T mapped_type |
| typedef Key key_type |
| typedef qptrdiff difference_type |
| typedef int size_type |
| QHash | ( | ) | [inline] |
| Q_OUTOFLINE_TEMPLATE bool operator== | ( | const QHash< Key, T > & | other | ) | const |
Definition at line 896 of file qhash.h.
{
if (size() != other.size())
return false;
if (d == other.d)
return true;
const_iterator it = begin();
while (it != end()) {
const Key &akey = it.key();
const_iterator it2 = other.find(akey);
do {
if (it2 == other.end() || !(it2.key() == akey))
return false;
if (!QTypeInfo<T>::isDummy && !(it.value() == it2.value()))
return false;
++it;
++it2;
} while (it != end() && it.key() == akey);
}
return true;
}
| bool operator!= | ( | const QHash< Key, T > & | other | ) | const [inline] |
| int size | ( | ) | const [inline] |
| bool isEmpty | ( | ) | const [inline] |
| int capacity | ( | ) | const [inline] |
| Q_INLINE_TEMPLATE void reserve | ( | int | size | ) |
| void squeeze | ( | ) | [inline] |
| void detach | ( | ) | [inline] |
| bool isDetached | ( | ) | const [inline] |
| void setSharable | ( | bool | sharable | ) | [inline] |
| bool isSharedWith | ( | const QHash< Key, T > & | other | ) | const [inline] |
| Q_INLINE_TEMPLATE void clear | ( | ) |
| Q_OUTOFLINE_TEMPLATE int remove | ( | const Key & | key | ) |
Definition at line 782 of file qhash.h.
{
if (isEmpty()) // prevents detaching shared null
return 0;
detach();
int oldSize = d->size;
Node **node = findNode(akey);
if (*node != e) {
bool deleteNext = true;
do {
Node *next = (*node)->next;
deleteNext = (next != e && next->key == (*node)->key);
deleteNode(*node);
*node = next;
--d->size;
} while (deleteNext);
d->hasShrunk();
}
return oldSize - d->size;
}
| Q_OUTOFLINE_TEMPLATE T take | ( | const Key & | key | ) |
| Q_INLINE_TEMPLATE bool contains | ( | const Key & | key | ) | const |
| Q_OUTOFLINE_TEMPLATE const Key key | ( | const T & | value | ) | const |
| Q_OUTOFLINE_TEMPLATE const Key key | ( | const T & | value, |
| const Key & | defaultKey | ||
| ) | const |
Definition at line 678 of file qhash.h.
{
const_iterator i = begin();
while (i != end()) {
if (i.value() == avalue)
return i.key();
++i;
}
return defaultValue;
}
| Q_INLINE_TEMPLATE const T value | ( | const Key & | key | ) | const |
| Q_INLINE_TEMPLATE const T value | ( | const Key & | key, |
| const T & | defaultValue | ||
| ) | const |
| Q_INLINE_TEMPLATE T & operator[] | ( | const Key & | key | ) |
| Q_INLINE_TEMPLATE const T operator[] | ( | const Key & | key | ) | const |
| Q_OUTOFLINE_TEMPLATE QList< Key > uniqueKeys | ( | ) | const |
Definition at line 626 of file qhash.h.
{
QList<Key> res;
res.reserve(size()); // May be too much, but assume short lifetime
const_iterator i = begin();
if (i != end()) {
for (;;) {
const Key &aKey = i.key();
res.append(aKey);
do {
if (++i == end())
goto break_out_of_outer_loop;
} while (aKey == i.key());
}
}
break_out_of_outer_loop:
return res;
}
| Q_OUTOFLINE_TEMPLATE QList< Key > keys | ( | ) | const |
Definition at line 646 of file qhash.h.
{
QList<Key> res;
res.reserve(size());
const_iterator i = begin();
while (i != end()) {
res.append(i.key());
++i;
}
return res;
}
| Q_OUTOFLINE_TEMPLATE QList< Key > keys | ( | const T & | value | ) | const |
Definition at line 659 of file qhash.h.
{
QList<Key> res;
const_iterator i = begin();
while (i != end()) {
if (i.value() == avalue)
res.append(i.key());
++i;
}
return res;
}
| Q_OUTOFLINE_TEMPLATE QList< T > values | ( | ) | const |
| Q_OUTOFLINE_TEMPLATE QList< T > values | ( | const Key & | key | ) | const |
| Q_OUTOFLINE_TEMPLATE int count | ( | const Key & | key | ) | const |
| iterator begin | ( | ) | [inline] |
| const_iterator begin | ( | ) | const [inline] |
Definition at line 461 of file qhash.h.
{ return const_iterator(d->firstNode()); }
| const_iterator constBegin | ( | ) | const [inline] |
Definition at line 462 of file qhash.h.
{ return const_iterator(d->firstNode()); }
| iterator end | ( | ) | [inline] |
| const_iterator end | ( | ) | const [inline] |
| const_iterator constEnd | ( | ) | const [inline] |
| int count | ( | ) | const [inline] |
| Q_INLINE_TEMPLATE QHash< Key, T >::const_iterator find | ( | const Key & | key | ) | const |
Definition at line 851 of file qhash.h.
{
return const_iterator(*findNode(akey));
}
| Q_INLINE_TEMPLATE QHash< Key, T >::const_iterator constFind | ( | const Key & | key | ) | const |
Definition at line 857 of file qhash.h.
{
return const_iterator(*findNode(akey));
}
Reimplemented in QMultiHash< Key, T >.
Definition at line 554 of file qhash.h.
{
QHash<Key, T> copy(other);
const_iterator it = copy.constEnd();
while (it != copy.constBegin()) {
--it;
insertMulti(it.key(), it.value());
}
return *this;
}
| bool empty | ( | ) | const [inline] |
friend class iterator
[friend] |
friend class const_iterator
[friend] |