qhash.h File Reference

#include <QtCore/qatomic.h>
#include <QtCore/qchar.h>
#include <QtCore/qiterator.h>
#include <QtCore/qlist.h>
#include <QtCore/qpair.h>

Go to the source code of this file.

Classes

struct   QHashData
struct   QHashData::Node
struct   QHashDummyValue
struct   QHashDummyNode< Key, T >
struct   QHashNode< Key, T >
class   QHash< Key, T >
class   QHash< Key, T >::iterator
class   QHash< Key, T >::const_iterator
class   QMultiHash< Key, T >

Defines

#define  Q_HASH_DECLARE_INT_NODES(key_type)

Functions

uint  qHash (char key)
uint  qHash (uchar key)
uint  qHash (signed char key)
uint  qHash (ushort key)
uint  qHash (short key)
uint  qHash (uint key)
uint  qHash (int key)
uint  qHash (ulong key)
uint  qHash (long key)
uint  qHash (quint64 key)
uint  qHash (qint64 key)
uint  qHash (QChar key)
Q_CORE_EXPORT uint  qHash (const QByteArray &key)
Q_CORE_EXPORT uint  qHash (const QString &key)
Q_CORE_EXPORT uint  qHash (const QStringRef &key)
Q_CORE_EXPORT uint  qHash (const QBitArray &key)
template<class T >
uint  qHash (const T *key)
template<typename T1 , typename T2 >
uint  qHash (const QPair< T1, T2 > &key)
bool  operator== (const QHashDummyValue &, const QHashDummyValue &)
  Q_DECLARE_TYPEINFO (QHashDummyValue, Q_MOVABLE_TYPE|Q_DUMMY_TYPE)
  Q_HASH_DECLARE_INT_NODES (int)
  Q_HASH_DECLARE_INT_NODES (uint)

Define Documentation

#define Q_HASH_DECLARE_INT_NODES (   key_type )
Value:
template <class T> \
    struct QHashDummyNode<key_type, T> { \
        QHashDummyNode *next; \
        union { uint h; key_type key; }; \
\
        inline QHashDummyNode(key_type /* key0 */) {} \
    }; \
\
    template <class T> \
    struct QHashNode<key_type, T> { \
        QHashNode *next; \
        union { uint h; key_type key; }; \
        T value; \
\
        inline QHashNode(key_type /* key0 */) {} \
        inline QHashNode(key_type /* key0 */, const T &value0) : value(value0) {} \
        inline bool same_key(uint h0, key_type) { return h0 == h; } \
    }

Definition at line 229 of file qhash.h.


Function Documentation

uint qHash ( char  key ) [inline]

Definition at line 62 of file qhash.h.

{ return uint(key); }
uint qHash ( uchar  key ) [inline]

Definition at line 63 of file qhash.h.

{ return uint(key); }
uint qHash ( signed char  key ) [inline]

Definition at line 64 of file qhash.h.

{ return uint(key); }
uint qHash ( ushort  key ) [inline]

Definition at line 65 of file qhash.h.

{ return uint(key); }
uint qHash ( short  key ) [inline]

Definition at line 66 of file qhash.h.

{ return uint(key); }
uint qHash ( uint  key ) [inline]

Definition at line 67 of file qhash.h.

{ return key; }
uint qHash ( int  key ) [inline]

Definition at line 68 of file qhash.h.

{ return uint(key); }
uint qHash ( ulong  key ) [inline]

Definition at line 69 of file qhash.h.

{
    if (sizeof(ulong) > sizeof(uint)) {
        return uint(((key >> (8 * sizeof(uint) - 1)) ^ key) & (~0U));
    } else {
        return uint(key & (~0U));
    }
}
uint qHash ( long  key ) [inline]

Definition at line 77 of file qhash.h.

{ return qHash(ulong(key)); }
uint qHash ( quint64  key ) [inline]

Definition at line 78 of file qhash.h.

{
    if (sizeof(quint64) > sizeof(uint)) {
        return uint(((key >> (8 * sizeof(uint) - 1)) ^ key) & (~0U));
    } else {
        return uint(key & (~0U));
    }
}
uint qHash ( qint64  key ) [inline]

Definition at line 86 of file qhash.h.

{ return qHash(quint64(key)); }
uint qHash ( QChar  key ) [inline]

Definition at line 87 of file qhash.h.

{ return qHash(key.unicode()); }
Q_CORE_EXPORT uint qHash ( const QByteArray key )
Q_CORE_EXPORT uint qHash ( const QString key )
Q_CORE_EXPORT uint qHash ( const QStringRef key )
Q_CORE_EXPORT uint qHash ( const QBitArray key )
uint qHash ( const T *  key ) [inline]

Definition at line 97 of file qhash.h.

{
    return qHash(reinterpret_cast<quintptr>(key));
}
uint qHash ( const QPair< T1, T2 > &  key ) [inline]

Definition at line 105 of file qhash.h.

{
    uint h1 = qHash(key.first);
    uint h2 = qHash(key.second);
    return ((h1 << 16) | (h1 >> 16)) ^ h2;
}
bool operator== ( const QHashDummyValue ,
const QHashDummyValue  
) [inline]

Definition at line 198 of file qhash.h.

{
    return true;
}
Q_DECLARE_TYPEINFO ( QHashDummyValue  ,
Q_MOVABLE_TYPE|  Q_DUMMY_TYPE 
)
Q_HASH_DECLARE_INT_NODES ( int  )
Q_HASH_DECLARE_INT_NODES ( uint  )