18#include <private/qhashedstring_p.h>
19#include <private/qprimefornumbits_p.h>
21#include <QtCore/qbytearray.h>
22#include <QtCore/qstring.h>
23#include <QtCore/qtaggedpointer.h>
45 Q_ASSERT(
key.size() <= std::numeric_limits<int>::max());
88 const char *
ckey =
nullptr;
111 QString s =
string.toQStringNoThrow();
130 return length ==
string.length() &&
131 hash ==
string.hash() &&
137 return length ==
string.length() &&
138 hash ==
string.hash() &&
162 template<
typename StringHash>
166 template<
typename OtherData>
213 int bucket = node->
hash % nb;
214 node->
next = newBuckets[bucket];
215 newBuckets[bucket] = node;
238 Q_ASSERT(
s.size() <= std::numeric_limits<int>::max());
248 Q_ASSERT(
s.size() <= std::numeric_limits<int>::max());
327 template<
typename StringHash,
typename Data>
330 template<
typename Data>
348 template<
typename Data,
typename Value>
379 inline void insert(
const K &,
const T &);
470 if (nodePool)
delete nodePool;
471 delete []
data.buckets;
473 data.buckets =
nullptr;
478 newedNodes =
nullptr;
485 return data.size== 0;
497 return data.numBuckets;
524 if (nodePool && nodePool->used != nodePool->count) {
525 Node *rv = nodePool->nodes + nodePool->used++;
526 initializeNode(rv, hashedString(
key));
540 if (nodePool && nodePool->used != nodePool->count) {
541 Node *rv = nodePool->nodes + nodePool->used++;
572 Node *mynode = takeNode(*(
const Node *)otherNode);
573 int bucket = mynode->
hash %
data.numBuckets;
574 mynode->
next =
data.buckets[bucket];
575 data.buckets[bucket] = mynode;
589 for (
int i = 0;
i <
other.data.numBuckets; ++
i) {
597template<
typename Data>
603 if (This->nodePool && node >= This->nodePool->nodes &&
604 node < (This->nodePool->nodes + This->nodePool->used)) {
606 if (node < This->nodePool->nodes)
612 if (node ==
nullptr && This->nodePool && This->nodePool->used)
613 node = This->nodePool->nodes + This->nodePool->used - 1;
623template<
typename StringHash,
typename Data>
626 typename StringHash::Node *
n =
nullptr;
627 if (self->newedNodes)
628 n = self->newedNodes;
629 else if (self->nodePool && self->nodePool->used)
630 n = self->nodePool->nodes + self->nodePool->used - 1;
642 return insertNode(
n,
n->hash);
650 return insertNode(
n, hashOf(
key));
657 data.rehashToBits(
data.numBits + 1);
659 int bucket =
hash %
data.numBuckets;
660 n->next =
data.buckets[bucket];
661 data.buckets[bucket] =
n;
698 while (node && !node->
equals(hashedKey))
709 return n?&
n->value:
nullptr;
727 Node *
n = findNode(
string);
728 return n?&
n->value:
nullptr;
743 if (
n)
return n->value;
744 else return createNode(
key, T())->value;
750 if (nodePool || 0 ==
n)
756 nodePool->nodes =
new Node[
n];
758 data.rehashToSize(
n);
static bool compare(const QChar *lhs, const char *rhs, int length)
static HashedForm< QHashedStringRef >::Type hashedString(const QHashedStringRef &s)
static const QString & toQString(const QString &s)
static HashedForm< constQV4::String * >::Type hashedString(const QV4::String *s)
static quint32 hashOf(const K &key)
static HashedForm< QV4::String * >::Type hashedString(QV4::String *s)
static QString toQString(const QLatin1String &s)
static QString toQString(const QV4::String *s)
static HashedForm< QHashedString >::Type hashedString(const QHashedString &s)
static HashedForm< QLatin1StringView >::Type hashedString(QLatin1StringView s)
static quint32 hashOf(const QHashedStringRef &s)
static QString toQString(const QHashedStringRef &s)
static HashedForm< QStringView >::Type hashedString(QStringView s)
static quint32 hashOf(const QV4::String *s)
static quint32 hashOf(QV4::String *s)
static HashedForm< QString >::Type hashedString(const QString &s)
static QString toQString(const QHashedCStringRef &s)
static HashedForm< QHashedCStringRef >::Type hashedString(const QHashedCStringRef &s)
static const QString & toQString(const QHashedString &s)
void rehashToBits(short bits)
QStringHashData()=default
QStringHashNode ** buckets
void rehashToSize(int size)
~QStringHashData()=default
void rehashNode(QStringHashNode **newBuckets, int nb, QStringHashNode *node)
bool equals(const QHashedCStringRef &string) const
QStringHashNode(const QHashedString &key)
const char16_t * utf16Data() const
QHashedString key() const
const char * cStrData() const
bool equals(const QV4::String *string) const
QStringHashNode(const QHashedCStringRef &key)
QTypedArrayData< char16_t > * arrayData
bool equals(const QV4::Value &string) const
QTaggedPointer< QStringHashNode, Tag > next
bool equals(const QHashedStringRef &string) const
QStringHashNode(const QStringHashNode &o)
bool equals(const K &key) const
bool operator!=(const Iterator &o) const
bool operator==(const Iterator &o) const
Value & operator*() const
QHashedString key() const
Node * takeNode(const K &key, const T &value)
void copyAndReserve(const QStringHash< T > &other, int additionalReserve)
void initializeNode(Node *, const QHashedString &key)
void copyNode(const QStringHashNode *otherNode)
bool contains(const K &) const
ConstIterator end() const
Iterator< MutableIteratorData, ListLayout::Role * > MutableIterator
MutableIterator find(const K &)
ReservedNodePool * nodePool
Node * findNode(const K &) const
ConstIterator begin() const
static Data iterateFirst(StringHash *self)
T * value(const QV4::String *string) const
QStringHash & operator=(const QStringHash< T > &)
ConstIterator constEnd() const
void copy(const QStringHash< T > &)
Node * insertNode(Node *, quint32)
ConstIterator constBegin() const
T & operator[](const K &)
void insert(const MutableIterator &)
void insert(const K &, const T &)
T * value(const ConstIterator &) const
Iterator< ConstIteratorData, const ListLayout::Role * > ConstIterator
T * value(const K &) const
ConstIterator find(const K &) const
void insert(const ConstIterator &)
Node * createNode(const Node &o)
static Data iterateNext(const Data &)
T * value(const MutableIterator &) const
Node * createNode(const K &, const T &)
Node * takeNode(const Node &o)
QStringHash(const QStringHash &)
void initializeNode(Node *, const QHashedCStringRef &key)
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
T * data() const noexcept
QHash< int, QWidget * > hash
[35multi]
cache insert(employee->id(), employee)
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
static jboolean copy(JNIEnv *, jobject)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
GLsizei const GLchar *const * string
[0]
const void * data_ptr(const QTransform &t)
QT_BEGIN_NAMESPACE int qPrimeForNumBits(int numBits)
QLatin1StringView QLatin1String
static QT_BEGIN_NAMESPACE QString::DataPointer & mutableStringData(const QHashedString &key)
QArrayDataPointer< char16_t > QStringPrivate
bool deref() noexcept
Returns false if deallocation is necessary.
bool ref() noexcept
Returns true if sharing took place.
IteratorData(const OtherData &other)
IteratorData(QStringHashNode *n=nullptr, StringHash *p=nullptr)
NewedNode(const QHashedCStringRef &key, const T &value)
NewedNode(const QHashedString &key, const T &value)
Node(const QHashedCStringRef &key, const T &value)
Node(const QHashedString &key, const T &value)
static void deallocate(QArrayData *data) noexcept