Logo Search packages:      
Sourcecode: qt4-x11 version File versions

template<class Key, class T>
Q_OUTOFLINE_TEMPLATE int QHash< Key, T >::remove ( const Key &  key  )  [inline, inherited]

Removes all the items that have the key key from the hash. Returns the number of items removed which is usually 1 but will be 0 if the key isn't in the hash, or greater than 1 if insertMulti() has been used with the key.

See also:
clear(), take()

Definition at line 709 of file qhash.h.

References QHash< Key, T >::detach().

Referenced by QFont::removeSubstitution(), and QExtensionManager::unregisterExtensions().

{
    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;
}


Generated by  Doxygen 1.6.0   Back to index