QtCore/qhash.h File Reference

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

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 >
 

Macros

#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 (short)
 
 Q_HASH_DECLARE_INT_NODES (ushort)
 
 Q_HASH_DECLARE_INT_NODES (int)
 
 Q_HASH_DECLARE_INT_NODES (uint)
 

Macro Definition Documentation

#define Q_HASH_DECLARE_INT_NODES (   key_type)
Value:
template <class T> \
QHashDummyNode *next; \
union { uint h; key_type key; }; \
\
inline QHashDummyNode(key_type /* key0 */) {} \
}; \
\
template <class 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; } \
}
GLsizei const GLfloat * value
Definition: GLee.h:1742
int int int int int int h
Definition: GLee.h:10534

Definition at line 229 of file qhash.h.

Function Documentation

uint qHash ( char  key)
inline

Definition at line 62 of file qhash.h.

62 { return uint(key); }
uint qHash ( uchar  key)
inline

Definition at line 63 of file qhash.h.

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

Definition at line 64 of file qhash.h.

64 { return uint(key); }
uint qHash ( ushort  key)
inline

Definition at line 65 of file qhash.h.

65 { return uint(key); }
uint qHash ( short  key)
inline

Definition at line 66 of file qhash.h.

66 { return uint(key); }
uint qHash ( uint  key)
inline

Definition at line 67 of file qhash.h.

67 { return key; }
uint qHash ( int  key)
inline

Definition at line 68 of file qhash.h.

68 { return uint(key); }
uint qHash ( ulong  key)
inline

Definition at line 69 of file qhash.h.

70 {
71  if (sizeof(ulong) > sizeof(uint)) {
72  return uint(((key >> (8 * sizeof(uint) - 1)) ^ key) & (~0U));
73  } else {
74  return uint(key & (~0U));
75  }
76 }
uint qHash ( long  key)
inline

Definition at line 77 of file qhash.h.

77 { return qHash(ulong(key)); }
uint qHash(char key)
Definition: qhash.h:62
uint qHash ( quint64  key)
inline

Definition at line 78 of file qhash.h.

79 {
80  if (sizeof(quint64) > sizeof(uint)) {
81  return uint(((key >> (8 * sizeof(uint) - 1)) ^ key) & (~0U));
82  } else {
83  return uint(key & (~0U));
84  }
85 }
unsigned long long quint64
Definition: qglobal.h:948
uint qHash ( qint64  key)
inline

Definition at line 86 of file qhash.h.

86 { return qHash(quint64(key)); }
unsigned long long quint64
Definition: qglobal.h:948
uint qHash(char key)
Definition: qhash.h:62
uint qHash ( QChar  key)
inline

Definition at line 87 of file qhash.h.

87 { return qHash(key.unicode()); }
uint qHash(char key)
Definition: qhash.h:62
ushort unicode() const
Definition: qchar.h:251
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.

98 {
99  return qHash(reinterpret_cast<quintptr>(key));
100 }
uint qHash(char key)
Definition: qhash.h:62
uint qHash ( const QPair< T1, T2 > &  key)
inline

Definition at line 105 of file qhash.h.

106 {
107  uint h1 = qHash(key.first);
108  uint h2 = qHash(key.second);
109  return ((h1 << 16) | (h1 >> 16)) ^ h2;
110 }
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
uint qHash(char key)
Definition: qhash.h:62
bool operator== ( const QHashDummyValue ,
const QHashDummyValue  
)
inline

Definition at line 198 of file qhash.h.

199 {
200  return true;
201 }
Q_DECLARE_TYPEINFO ( QHashDummyValue  ,
Q_MOVABLE_TYPE|  Q_DUMMY_TYPE 
)
Q_HASH_DECLARE_INT_NODES ( short  )
Q_HASH_DECLARE_INT_NODES ( ushort  )
Q_HASH_DECLARE_INT_NODES ( int  )
Q_HASH_DECLARE_INT_NODES ( uint  )

Go to the source code of this file.