diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-08-22 11:44:20 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-08-28 14:35:55 +0200 |
commit | 85dc06662e77a7e1a61300888ecf2af5ff29e4c3 (patch) | |
tree | 3db744e5f89da70b820f3089eab59ccafb10e8f0 /src/shared/proparser/proitems.cpp | |
parent | d97de7e43f6432a0c4a611c7268d06cd3741593d (diff) | |
download | qt-creator-85dc06662e77a7e1a61300888ecf2af5ff29e4c3.tar.gz |
simplify ProString::operator==() implementations
we can trivially construct a QStringRef from a ProString, so take
advantage of that.
Change-Id: I9aaa1f6d910590872b250a145f16e90984beeb94
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src/shared/proparser/proitems.cpp')
-rw-r--r-- | src/shared/proparser/proitems.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/shared/proparser/proitems.cpp b/src/shared/proparser/proitems.cpp index 962268ca7d..1b16ded4d5 100644 --- a/src/shared/proparser/proitems.cpp +++ b/src/shared/proparser/proitems.cpp @@ -155,39 +155,6 @@ QString &ProString::toQString(QString &tmp) const return tmp.setRawData(m_string.constData() + m_offset, m_length); } -bool ProString::operator==(const ProString &other) const -{ - if (m_length != other.m_length) - return false; - return !memcmp(m_string.constData() + m_offset, - other.m_string.constData() + other.m_offset, m_length * 2); -} - -bool ProString::operator==(const QString &other) const -{ - if (m_length != other.length()) - return false; - return !memcmp(m_string.constData() + m_offset, other.constData(), m_length * 2); -} - -bool ProString::operator==(const QLatin1String &other) const -{ - const ushort *uc = (ushort *)m_string.constData() + m_offset; - const ushort *e = uc + m_length; - const uchar *c = (uchar *)other.latin1(); - - if (!c) - return isEmpty(); - - while (*c) { - if (uc == e || *uc != *c) - return false; - ++uc; - ++c; - } - return (uc == e); -} - QChar *ProString::prepareAppend(int extraLen) { if (m_string.isDetached() && m_length + extraLen <= m_string.capacity()) { |