diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-06-25 21:53:06 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-28 14:55:55 +0200 |
commit | 4a3d5537dde71c57378da7e65e732d50f88e592a (patch) | |
tree | 066bd56f26a43b08478f17a5a10c716e5c6a811e /src/qml/qml/ftw/qhashedstring_p.h | |
parent | dfbec73b35cc600be0614081a0ef280d53a1c79e (diff) |
Remove an overoptimisation that was only used (wrongly) in one place
Let's simplify this code. The goal is to replace most of the
code in qhashedstring with an identifier based hash table.
Change-Id: I2f9a38ad0bb2f43a2b2b87914823c23ed231f48c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/ftw/qhashedstring_p.h')
-rw-r--r-- | src/qml/qml/ftw/qhashedstring_p.h | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index ca95839323..1261db234d 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -160,18 +160,13 @@ public: inline bool isLatin1() const; - inline int utf8length() const; - QByteArray toUtf8() const; - void writeUtf8(char *) const; private: friend class QHashedString; void computeHash() const; - void computeUtf8Length() const; const QChar *m_data; int m_length; - mutable int m_utf8length; mutable quint32 m_hash; }; @@ -1180,38 +1175,37 @@ QString QHashedV4String::toString() const } QHashedStringRef::QHashedStringRef() -: m_data(0), m_length(0), m_utf8length(-1), m_hash(0) +: m_data(0), m_length(0), m_hash(0) { } QHashedStringRef::QHashedStringRef(const QString &str) -: m_data(str.constData()), m_length(str.length()), m_utf8length(0), m_hash(0) +: m_data(str.constData()), m_length(str.length()), m_hash(0) { } QHashedStringRef::QHashedStringRef(const QStringRef &str) -: m_data(str.constData()), m_length(str.length()), m_utf8length(0), m_hash(0) +: m_data(str.constData()), m_length(str.length()), m_hash(0) { } QHashedStringRef::QHashedStringRef(const QChar *data, int length) -: m_data(data), m_length(length), m_utf8length(0), m_hash(0) +: m_data(data), m_length(length), m_hash(0) { } QHashedStringRef::QHashedStringRef(const QChar *data, int length, quint32 hash) -: m_data(data), m_length(length), m_utf8length(0), m_hash(hash) +: m_data(data), m_length(length), m_hash(hash) { } QHashedStringRef::QHashedStringRef(const QHashedString &string) -: m_data(string.constData()), m_length(string.length()), m_utf8length(0), m_hash(string.m_hash) +: m_data(string.constData()), m_length(string.length()), m_hash(string.m_hash) { } QHashedStringRef::QHashedStringRef(const QHashedStringRef &string) -: m_data(string.m_data), m_length(string.m_length), m_utf8length(string.m_utf8length), - m_hash(string.m_hash) +: m_data(string.m_data), m_length(string.m_length), m_hash(string.m_hash) { } @@ -1219,7 +1213,6 @@ QHashedStringRef &QHashedStringRef::operator=(const QHashedStringRef &o) { m_data = o.m_data; m_length = o.m_length; - m_utf8length = o.m_utf8length; m_hash = o.m_hash; return *this; } @@ -1304,13 +1297,6 @@ int QHashedStringRef::length() const return m_length; } -int QHashedStringRef::utf8length() const -{ - if (m_utf8length < m_length) - computeUtf8Length(); - return m_utf8length; -} - bool QHashedStringRef::isLatin1() const { for (int ii = 0; ii < m_length; ++ii) |