4#ifndef QHASHEDSTRING_P_H
5#define QHASHEDSTRING_P_H
18#include <QtCore/qglobal.h>
19#include <QtCore/qstring.h>
20#include <private/qv4string_p.h>
42 inline quint32 existingHash()
const;
45 static inline bool compare(
const char *lhs,
const char *rhs,
int length);
54 inline void computeHash()
const;
83 inline const QChar &
at(
int)
const;
84 inline const QChar *constData()
const;
85 bool startsWith(
const QString &)
const;
86 bool endsWith(
const QString &)
const;
91 inline bool isEmpty()
const;
93 inline bool startsWithUpper()
const;
97 inline bool isLatin1()
const;
102 inline void computeHash()
const;
120 inline int length()
const;
129 inline void computeHash()
const;
131 const char *
m_data =
nullptr;
169 m_hash =
string.m_hash;
175 return (
string.m_hash == m_hash || !
string.m_hash || !m_hash) &&
181 if (m_hash &&
string.m_hash && m_hash !=
string.m_hash)
183 QStringView otherView {
string.m_data,
string.m_length};
184 return static_cast<const QString &
>(*this) == otherView;
189 if (!m_hash) computeHash();
229 Q_ASSERT(
string.
size() <= std::numeric_limits<int>::max());
240 m_length =
o.m_length;
253 if (m_hash &&
string.m_hash && m_hash !=
string.m_hash)
257 return view == otherView;
262 if (m_hash &&
string.m_hash && m_hash !=
string.m_hash)
265 QStringView otherView {
string.m_data,
string.m_length};
266 return view == otherView;
271 return m_length ==
string.m_length &&
272 (m_hash ==
string.m_hash || !m_hash || !
string.m_hash) &&
278 return !(*
this ==
string);
283 return !(*
this ==
string);
288 return !(*
this ==
string);
293 return !(*
this ==
string);
298 return const_cast<QChar *
>(m_data);
304 return m_data[
index];
314 return m_length == 0;
324 for (
int ii = 0; ii < m_length; ++ii)
325 if (m_data[ii].unicode() > 127)
return false;
329void QHashedStringRef::computeHash()
const
336 if (m_length < 1)
return false;
337 return m_data[0].isUpper();
342 if (!m_hash) computeHash();
367 if (!m_hash) computeHash();
399void QHashedCStringRef::computeHash()
const
409 if (*l++ != *rhs++)
return false;
416 return 0 == ::memcmp(lhs, rhs,
length);
430void QHashedString::computeHash()
const
Q_AUTOTEST_EXPORT QString toUtf16() const
const char * constData() const
void writeUtf16(QChar *) const
const QChar & at(int) const
const QChar * constData() const
bool startsWithUpper() const
bool operator==(const QString &string) const
QHashedStringRef & operator=(const QHashedStringRef &)
bool operator!=(const QString &string) const
bool operator==(const QHashedString &string) const
static bool compare(const QChar *lhs, const char *rhs, int length)
quint32 existingHash() const
QHashedString & operator=(const QHashedString &string)
static quint32 stringHash(const QChar *data, int length)
const_pointer constData() const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
const QChar * constData() const
Returns a pointer to the data stored in the QString.
qsizetype size() const noexcept
Returns the number of characters in this string.
QHash< int, QWidget * > hash
[35multi]
Combined button and popup list for selecting options.
const QString & asString(const QString &s)
constexpr bool operator!=(const timespec &t1, const timespec &t2)
size_t qHash(const QHashedString &string)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei const GLchar *const * string
[0]
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
static void split(QT_FT_Vector *b)
static constexpr QChar sep
#define Q_AUTOTEST_EXPORT
static int compare(quint64 a, quint64 b)
QT_BEGIN_NAMESPACE typedef uchar * output
char * toString(const MyType &t)
[31]
static uint createHashValue(const QChar *ch, int length, uint *subtype)