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;
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;
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
constexpr bool isUpper() const noexcept
Returns true if the character is an uppercase letter, for example category() is Letter_Uppercase.
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
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
friend bool operator!=(const QString &s1, const QString &s2) noexcept
Returns true if string s1 is not equal to string s2; otherwise returns false.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
friend bool operator==(const QString &s1, const QString &s2) noexcept
const QChar * constData() const
Returns a pointer to the data stored in the QString.
QString & operator=(QChar c)
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QChar * data()
Returns a pointer to the data stored in the QString.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
qsizetype length() const
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)
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]
static constexpr QChar sep
#define Q_AUTOTEST_EXPORT
QT_BEGIN_NAMESPACE typedef uchar * output
char * toString(const MyType &t)
[31]
static uint createHashValue(const QChar *ch, int length, uint *subtype)