OSDN Git Service

get rid of QStringBuilder
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 4 May 2019 17:20:49 +0000 (17:20 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 4 May 2019 17:20:49 +0000 (17:20 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
21 files changed:
scripts/incfsck.py
src/core/CMakeLists.txt
src/core/kernel/qcore_unix_p.h
src/core/tools/qbytearray.cpp
src/core/tools/qstring.cpp
src/core/tools/qstring.h
src/core/tools/qstringbuilder.cpp [deleted file]
src/core/tools/qstringbuilder.h [deleted file]
src/core/tools/tools.cmake
src/gui/image/qicon.cpp
src/gui/image/qiconloader.cpp
src/gui/image/qpixmap.cpp
src/gui/painting/qbrush.cpp
src/gui/painting/qpaintengine_x11.cpp
src/gui/painting/qpainter.cpp
src/gui/styles/qplastiquestyle.cpp
src/gui/styles/qstyle.qrc
src/gui/styles/qstylehelper.cpp
src/gui/styles/qstylehelper_p.h
src/gui/styles/qwindowsstyle.cpp
src/shared/qclass_lib_map.h

index 8fa1a5d..9d000c4 100755 (executable)
@@ -10,7 +10,6 @@ incmap = {
         'QGenericArgument': 'qobjectdefs.h',
         'QProcessEnvironment': 'qprocess.h',
         'QMutableHashIterator': 'qhash.h',
-        'QLatin1Literal': 'qstringbuilder.h',
         'QObjectList': 'qobject.h',
         'QMapIterator': 'qmap.h',
         'QMutexLocker': 'qmutex.h',
index 7fb4f89..f625305 100644 (file)
@@ -94,7 +94,6 @@ set(CORE_PUBLIC_HEADERS
     QStdWString
     QtAlgorithms
     QAbstractItemModel
-    QStringBuilder
     QSignalTransition
     QTextBoundaryFinder
     QExplicitlySharedDataPointer
@@ -134,12 +133,10 @@ set(CORE_PUBLIC_HEADERS
     QDirIterator
     QtMsgHandler
     QSharedMemory
-    QAbstractConcatenable
     QReadWriteLock
     QFileSystemWatcher
     QObjectList
     QContiguousCacheTypedData
-    QForeachContainer
     QtCleanUpFunction
     QSharedPointer
     QInternal
@@ -174,7 +171,6 @@ set(CORE_PUBLIC_HEADERS
     QCharRef
     QReturnArgument
     QMetaObjectAccessor
-    QConcatenable
     QLocale
     QMetaType
     QVariant
@@ -191,7 +187,6 @@ set(CORE_PUBLIC_HEADERS
     QAtomicInt
     QtContainerFwd
     QTimeLine
-    QForeachContainerBase
     QMutableFutureIterator
     QtPluginInstanceFunction
     QTextCodec
index 8fdf7ed..e1ec291 100644 (file)
@@ -324,7 +324,7 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
 #  define _POSIX_MONOTONIC_CLOCK -1
 #endif
 
-timeval qt_gettime(); // in qelapsedtimer_mac.cpp or qtimestamp_unix.cpp
+timeval qt_gettime(); // in qelapsedtimer_unix.cpp
 
 Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
                                  const struct timeval *tv);
index b2e1e9c..2773c7e 100644 (file)
@@ -387,7 +387,7 @@ static const quint16 crc_tbl[16] = {
     0xc60c, 0xd68d, 0xe70e, 0xf78f
 };
 
-/*! 
+/*!
     \relates QByteArray
 
     Returns the CRC-16 checksum of the first \a len bytes of \a data.
@@ -412,7 +412,7 @@ quint16 qChecksum(const char *data, uint len)
     return ~crc & 0xffff;
 }
 
-/*!     
+/*!
     \fn QByteArray qCompress(const QByteArray& data, int compressionLevel)
 
     \relates QByteArray
index f184053..8771149 100644 (file)
@@ -642,64 +642,6 @@ static int findChar(const QChar *str, int len, QChar ch, int from,
     formats, the \e precision represents the maximum number of
     significant digits (trailing zeroes are omitted).
 
-    \section1 More Efficient String Construction
-
-    Using the QString \c{'+'} operator, it is easy to construct a
-    complex string from multiple substrings. You will often write code
-    like this:
-
-    \snippet doc/src/snippets/qstring/stringbuilder.cpp 0
-
-    There is nothing wrong with either of these string constructions,
-    but there are a few hidden inefficiencies. Beginning with Qt 4.6,
-    you can eliminate them.
-
-    First, multiple uses of the \c{'+'} operator usually means
-    multiple memory allocations. When concatenating \e{n} substrings,
-    where \e{n > 2}, there can be as many as \e{n - 1} calls to the
-    memory allocator.
-
-    Second, QLatin1String does not store its length internally but
-    calls qstrlen() when it needs to know its length.
-
-    In 4.6, an internal template class \c{QStringBuilder} has been
-    added along with a few helper functions. This class is marked
-    internal and does not appear in the documentation, because you
-    aren't meant to instantiate it in your code. Its use will be
-    automatic, as described below. The class is found in
-    \c {src/corelib/tools/qstringbuilder.cpp} if you want to have a
-    look at it.
-
-    \c{QStringBuilder} uses expression templates and reimplements the
-    \c{'%'} operator so that when you use \c{'%'} for string
-    concatenation instead of \c{'+'}, multiple substring
-    concatenations will be postponed until the final result is about
-    to be assigned to a QString. At this point, the amount of memory
-    required for the final result is known. The memory allocator is
-    then called \e{once} to get the required space, and the substrings
-    are copied into it one by one.
-
-    Additional efficiency is gained by inlining and reduced reference
-    counting (the QString created from a \c{QStringBuilder} typically
-    has a ref count of 1, whereas QString::append() needs an extra
-    test).
-
-    There are three ways you can access this improved method of string
-    construction. The straightforward way is to include
-    \c{QStringBuilder} wherever you want to use it, and use the
-    \c{'%'} operator instead of \c{'+'} when concatenating strings:
-
-    \snippet doc/src/snippets/qstring/stringbuilder.cpp 5
-
-    A more global approach which is the most convenient but
-    not entirely source compatible, is to this define in your
-    .pro file:
-
-    \snippet doc/src/snippets/qstring/stringbuilder.cpp 3
-
-    and the \c{'+'} will automatically be performed as the
-    \c{QStringBuilder} \c{'%'} everywhere.
-
     \sa fromRawData(), QChar, QLatin1String, QByteArray, QStringRef
 */
 
@@ -1013,7 +955,7 @@ QString::QString(const int size, const QChar ch)
   \internal
 
   Constructs a string of the given \a size without initializing the
-  characters. This is only used in \c QStringBuilder::toString().
+  characters.
 */
 QString::QString(int size, Qt::Initialization)
 {
index a15a7e8..3866b63 100644 (file)
@@ -523,10 +523,8 @@ private:
     static Data *fromAscii_helper(const char *str, int size = -1);
     void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen);
     friend class QCharRef;
-    friend class QCFString;
     friend class QTextCodec;
     friend class QStringRef;
-    friend struct QAbstractConcatenable;
     friend inline bool qStringComparisonHelper(const QString &s1, const char *s2);
     friend inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2);
 public:
@@ -574,7 +572,6 @@ private:
 };
 
 
-
 inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1()))
 { }
 inline int QString::length() const
@@ -864,7 +861,6 @@ inline int QByteArray::lastIndexOf(const QString &s, int from) const
 { return lastIndexOf(s.toAscii(), from); }
 #endif // QT_NO_CAST_TO_ASCII
 
-#if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER)
 inline const QString operator+(const QString &s1, const QString &s2)
 { QString t(s1); t += s2; return t; }
 inline const QString operator+(const QString &s1, QChar s2)
@@ -885,7 +881,6 @@ inline QT_ASCII_CAST_WARN const QString operator+(const QByteArray &ba, const QS
 inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteArray &ba)
 { QString t(s); t += QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); return t; }
 #  endif // QT_NO_CAST_FROM_ASCII
-#endif // QT_USE_QSTRINGBUILDER
 
 inline std::string QString::toStdString() const
 { return toAscii().toStdString(); }
@@ -1101,14 +1096,8 @@ inline bool QStringRef::contains(QChar c, Qt::CaseSensitivity cs) const
 inline bool QStringRef::contains(const QStringRef &s, Qt::CaseSensitivity cs) const
 { return indexOf(s, 0, cs) != -1; }
 
-
-
 QT_END_NAMESPACE
 
 QT_END_HEADER
 
-#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
-#include <QtCore/qstringbuilder.h>
-#endif
-
 #endif // QSTRING_H
diff --git a/src/core/tools/qstringbuilder.cpp b/src/core/tools/qstringbuilder.cpp
deleted file mode 100644 (file)
index f5312a1..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qstringbuilder.h"
-#include <QtCore/qtextcodec.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
-    \class QStringBuilder
-    \internal
-    \reentrant
-    \since 4.6
-
-    \brief The QStringBuilder class is a template class that provides a facility to build up QStrings from smaller chunks.
-
-    \ingroup tools
-    \ingroup shared
-    \ingroup string-processing
-
-
-    To build a QString by multiple concatenations, QString::operator+()
-    is typically used. This causes \e{n - 1} reallocations when building
-    a string from \e{n} chunks.
-
-    QStringBuilder uses expression templates to collect the individual
-    chunks, compute the total size, allocate the required amount of
-    memory for the final QString object, and copy the chunks into the
-    allocated memory.
-
-    The QStringBuilder class is not to be used explicitly in user
-    code.  Instances of the class are created as return values of the
-    operator%() function, acting on objects of type QString,
-    QLatin1String, QStringRef, QChar, QCharRef, QLatin1Char, and \c char.
-
-    Concatenating strings with operator%() generally yields better
-    performance then using \c QString::operator+() on the same chunks
-    if there are three or more of them, and performs equally well in other
-    cases.
-
-    \sa QString
-*/
-
-/*! \fn QStringBuilder::QStringBuilder(const A &a, const B &b)
-  Constructs a QStringBuilder from \a a and \a b.
- */
-
-/* \fn QStringBuilder::operator%(const A &a, const B &b)
-
-    Returns a \c QStringBuilder object that is converted to a QString object
-    when assigned to a variable of QString type or passed to a function that
-    takes a QString parameter.
-
-    This function is usable with arguments of type \c QString,
-    \c QLatin1String, \c QStringRef, \c QChar, \c QCharRef, \c QLatin1Char,
-    and \c char.
-*/
-
-/*! \fn QByteArray QStringBuilder::toLatin1() const
-  Returns a Latin-1 representation of the string as a QByteArray.  The
-  returned byte array is undefined if the string contains non-Latin1
-  characters.
- */
-
-/*!
-    \fn operator QStringBuilder::QString() const
-    Converts the \c QLatin1String into a \c QString object.
-*/
-
-/*! \internal
-   Note: The len contains the ending \0
- */
-void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out)
-{
-#ifndef QT_NO_TEXTCODEC
-    if (QString::codecForCStrings && len) {
-        QString tmp = QString::fromAscii(a, len > 0 ? len - 1 : -1);
-        memcpy(out, reinterpret_cast<const char *>(tmp.constData()), sizeof(QChar) * tmp.size());
-        out += tmp.length();
-        return;
-    }
-#endif
-    if (len == -1) {
-        if (!a)
-            return;
-        while (*a)
-            *out++ = QLatin1Char(*a++);
-    } else {
-        for (int i = 0; i < len - 1; ++i)
-            *out++ = QLatin1Char(a[i]);
-    }
-}
-
-/*! \internal */
-void QAbstractConcatenable::convertToAscii(const QChar* a, int len, char*& out) 
-{
-#ifndef QT_NO_TEXTCODEC
-    if (QString::codecForCStrings) {
-        QByteArray tmp = QString::codecForCStrings->fromUnicode(a, len);
-        memcpy(out, tmp.constData(), tmp.size());
-        out += tmp.length();
-        return;
-    }
-#endif
-    if (len == -1) {
-        while (a->unicode())
-            convertToLatin1(*a++, out);
-    } else {
-        for (int i = 0; i < len; ++i)
-            convertToLatin1(a[i], out);
-    }
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/core/tools/qstringbuilder.h b/src/core/tools/qstringbuilder.h
deleted file mode 100644 (file)
index 948b429..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSTRINGBUILDER_H
-#define QSTRINGBUILDER_H
-
-#include <QtCore/qstring.h>
-#include <QtCore/qbytearray.h>
-
-#include <string.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-struct Q_CORE_EXPORT QAbstractConcatenable
-{
-protected:
-    static void convertFromAscii(const char *a, int len, QChar *&out);
-    static void convertToAscii(const QChar *a, int len, char *&out);
-    static inline void convertFromAscii(char a, QChar *&out)
-    {
-#ifndef QT_NO_TEXTCODEC
-        if (QString::codecForCStrings)
-            *out++ = QChar::fromAscii(a);
-        else
-#endif
-            *out++ = QLatin1Char(a);
-    }
-
-    static inline void convertToAscii(QChar a, char *&out)
-    {
-#ifndef QT_NO_TEXTCODEC
-        if (QString::codecForCStrings)
-            *out++ = a.toAscii(); //###
-        else
-#endif
-            convertToLatin1(a, out);
-    }
-
-    static inline void convertToLatin1(QChar a, char *&out)
-    {
-        *out++ = a.unicode() > 0xff ? '?' : char(a.unicode());
-    }
-};
-
-template <typename T> struct QConcatenable {};
-
-template <typename A, typename B>
-class QStringBuilder
-{
-public:
-    QStringBuilder(const A &a_, const B &b_) : a(a_), b(b_) {}
-private:
-    friend class QByteArray;
-    friend class QString;
-    template <typename T> T convertTo() const
-    {
-        const uint len = QConcatenable< QStringBuilder<A, B> >::size(*this);
-        T s(len, Qt::Uninitialized);
-
-        typename T::iterator d = s.data();
-        typename T::const_iterator const start = d;
-        QConcatenable< QStringBuilder<A, B> >::appendTo(*this, d);
-
-        if (!QConcatenable< QStringBuilder<A, B> >::ExactSize && int(len) != d - start) {
-            // this resize is necessary since we allocate a bit too much
-            // when dealing with variable sized 8-bit encodings
-            s.resize(d - start);
-        }
-        return s;
-    }
-
-    typedef QConcatenable<QStringBuilder<A, B> > Concatenable;
-    typedef typename Concatenable::ConvertTo ConvertTo;
-public:
-    operator ConvertTo() const { return convertTo<ConvertTo>(); }
-
-    QByteArray toLatin1() const { return convertTo<QString>().toLatin1(); }
-    int size() const { return Concatenable::size(*this); }
-
-    const A &a;
-    const B &b;
-};
-
-template <>
-class QStringBuilder <QString, QString>
-{
-    public:
-        QStringBuilder(const QString &a_, const QString &b_) : a(a_), b(b_) {}
-
-        operator QString() const
-        { QString r(a); r += b; return r; }
-        QByteArray toLatin1() const { return QString(*this).toLatin1(); }
-
-        const QString &a;
-        const QString &b;
-};
-
-template <>
-class QStringBuilder <QByteArray, QByteArray>
-{
-    public:
-        QStringBuilder(const QByteArray &a_, const QByteArray &b_) : a(a_), b(b_) {}
-
-        operator QByteArray() const
-        { QByteArray r(a); r += b; return r; }
-
-        const QByteArray &a;
-        const QByteArray &b;
-};
-
-
-template <> struct QConcatenable<char> : private QAbstractConcatenable
-{
-    typedef char type;
-    typedef QByteArray ConvertTo;
-    enum { ExactSize = true };
-    static int size(const char) { return 1; }
-#ifndef QT_NO_CAST_FROM_ASCII
-    static inline QT_ASCII_CAST_WARN void appendTo(const char c, QChar *&out)
-    {
-        QAbstractConcatenable::convertFromAscii(c, out);
-    }
-#endif
-    static inline void appendTo(const char c, char *&out)
-    { *out++ = c; }
-};
-
-template <> struct QConcatenable<QLatin1Char>
-{
-    typedef QLatin1Char type;
-    typedef QString ConvertTo;
-    enum { ExactSize = true };
-    static int size(const QLatin1Char) { return 1; }
-    static inline void appendTo(const QLatin1Char c, QChar *&out)
-    { *out++ = c; }
-    static inline void appendTo(const QLatin1Char c, char *&out)
-    { *out++ = c.toLatin1(); }
-};
-
-template <> struct QConcatenable<QChar> : private QAbstractConcatenable
-{
-    typedef QChar type;
-    typedef QString ConvertTo;
-    enum { ExactSize = true };
-    static int size(const QChar) { return 1; }
-    static inline void appendTo(const QChar c, QChar *&out)
-    { *out++ = c; }
-#ifndef QT_NO_CAST_TO_ASCII
-    static inline QT_ASCII_CAST_WARN void appendTo(const QChar c, char *&out)
-    { convertToAscii(c, out); }
-#endif
-};
-
-template <> struct QConcatenable<QCharRef> : private QAbstractConcatenable
-{
-    typedef QCharRef type;
-    typedef QString ConvertTo;
-    enum { ExactSize = true };
-    static int size(const QCharRef &) { return 1; }
-    static inline void appendTo(const QCharRef &c, QChar *&out)
-    { *out++ = QChar(c); }
-#ifndef QT_NO_CAST_TO_ASCII
-    static inline QT_ASCII_CAST_WARN void appendTo(const QCharRef &c, char *&out)
-    { convertToAscii(c, out); }
-#endif
-};
-
-template <> struct QConcatenable<QLatin1String>
-{
-    typedef QLatin1String type;
-    typedef QString ConvertTo;
-    enum { ExactSize = true };
-    static int size(const QLatin1String &a) { return qstrlen(a.latin1()); }
-    static inline void appendTo(const QLatin1String &a, QChar *&out)
-    {
-        for (const char *s = a.latin1(); *s; )
-            *out++ = QLatin1Char(*s++);
-    }
-    static inline void appendTo(const QLatin1String &a, char *&out)
-    {
-        for (const char *s = a.latin1(); *s; )
-            *out++ = *s++;
-    }
-};
-
-template <> struct QConcatenable<QString> : private QAbstractConcatenable
-{
-    typedef QString type;
-    typedef QString ConvertTo;
-    enum { ExactSize = true };
-    static int size(const QString &a) { return a.size(); }
-    static inline void appendTo(const QString &a, QChar *&out)
-    {
-        const int n = a.size();
-        memcpy(out, reinterpret_cast<const char*>(a.constData()), sizeof(QChar) * n);
-        out += n;
-    }
-#ifndef QT_NO_CAST_TO_ASCII
-    static inline QT_ASCII_CAST_WARN void appendTo(const QString &a, char *&out)
-    { convertToAscii(a.constData(), a.length(), out); }
-#endif
-};
-
-template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
-{
-    typedef QStringRef type;
-    typedef QString ConvertTo;
-    enum { ExactSize = true };
-    static int size(const QStringRef &a) { return a.size(); }
-    static inline void appendTo(const QStringRef &a, QChar *&out)
-    {
-        const int n = a.size();
-        memcpy(out, reinterpret_cast<const char*>(a.constData()), sizeof(QChar) * n);
-        out += n;
-    }
-#ifndef QT_NO_CAST_TO_ASCII
-    static inline QT_ASCII_CAST_WARN void appendTo(const QStringRef &a, char *&out)
-    { convertToAscii(a.constData(), a.length(), out); }
-#endif
-
-};
-
-template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable
-{
-    typedef char type[N];
-    typedef QByteArray ConvertTo;
-    enum { ExactSize = false };
-    static int size(const char[N]) { return N - 1; }
-#ifndef QT_NO_CAST_FROM_ASCII
-    static inline void QT_ASCII_CAST_WARN appendTo(const char a[N], QChar *&out)
-    {
-        QAbstractConcatenable::convertFromAscii(a, N, out);
-    }
-#endif
-    static inline void appendTo(const char a[N], char *&out)
-    {
-        while (*a)
-            *out++ = *a++;
-    }
-};
-
-template <int N> struct QConcatenable<const char[N]> : private QAbstractConcatenable
-{
-    typedef const char type[N];
-    typedef QByteArray ConvertTo;
-    enum { ExactSize = false };
-    static int size(const char[N]) { return N - 1; }
-#ifndef QT_NO_CAST_FROM_ASCII
-    static inline void QT_ASCII_CAST_WARN appendTo(const char a[N], QChar *&out)
-    {
-        QAbstractConcatenable::convertFromAscii(a, N, out);
-    }
-#endif
-    static inline void appendTo(const char a[N], char *&out)
-    {
-        while (*a)
-            *out++ = *a++;
-    }
-};
-
-template <> struct QConcatenable<const char *> : private QAbstractConcatenable
-{
-    typedef char const *type;
-    typedef QByteArray ConvertTo;
-    enum { ExactSize = false };
-    static int size(const char *a) { return qstrlen(a); }
-#ifndef QT_NO_CAST_FROM_ASCII
-    static inline void QT_ASCII_CAST_WARN appendTo(const char *a, QChar *&out)
-    { QAbstractConcatenable::convertFromAscii(a, -1, out); }
-#endif
-    static inline void appendTo(const char *a, char *&out)
-    {
-        if (!a)
-            return;
-        while (*a)
-            *out++ = *a++;
-    }
-};
-
-template <> struct QConcatenable<QByteArray> : private QAbstractConcatenable
-{
-    typedef QByteArray type;
-    typedef QByteArray ConvertTo;
-    enum { ExactSize = false };
-    static int size(const QByteArray &ba) { return ba.size(); }
-#ifndef QT_NO_CAST_FROM_ASCII
-    static inline void appendTo(const QByteArray &ba, QChar *&out)
-    {
-        // adding 1 because convertFromAscii expects the size including the null-termination
-        QAbstractConcatenable::convertFromAscii(ba.constData(), ba.size() + 1, out);
-    }
-#endif
-    static inline void appendTo(const QByteArray &ba, char *&out)
-    {
-        const char *a = ba.constData();
-        const char * const end = ba.end();
-        while (a != end)
-            *out++ = *a++;
-    }
-};
-
-namespace QtStringBuilder {
-    template <typename A, typename B> struct ConvertToTypeHelper
-    { typedef A ConvertTo; };
-    template <typename T> struct ConvertToTypeHelper<T, QString>
-    { typedef QString ConvertTo; };
-}
-
-template <typename A, typename B>
-struct QConcatenable< QStringBuilder<A, B> >
-{
-    typedef QStringBuilder<A, B> type;
-    typedef typename QtStringBuilder::ConvertToTypeHelper<typename QConcatenable<A>::ConvertTo, typename QConcatenable<B>::ConvertTo>::ConvertTo ConvertTo;
-    enum { ExactSize = QConcatenable<A>::ExactSize && QConcatenable<B>::ExactSize };
-    static int size(const type &p)
-    {
-        return QConcatenable<A>::size(p.a) + QConcatenable<B>::size(p.b);
-    }
-    template<typename T> static inline void appendTo(const type &p, T *&out)
-    {
-        QConcatenable<A>::appendTo(p.a, out);
-        QConcatenable<B>::appendTo(p.b, out);
-    }
-};
-
-template <typename A, typename B>
-QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>
-operator%(const A &a, const B &b)
-{
-   return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b);
-}
-
-// QT_USE_FAST_OPERATOR_PLUS was introduced in 4.7, QT_USE_QSTRINGBUILDER is to be used from 4.8 onwards
-// QT_USE_FAST_OPERATOR_PLUS does not remove the normal operator+ for QByteArray
-#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
-template <typename A, typename B>
-QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>
-operator+(const A &a, const B &b)
-{
-   return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b);
-}
-#endif
-
-template <typename A, typename B>
-QByteArray &operator+=(QByteArray &a, const QStringBuilder<A, B> &b)
-{
-#ifndef QT_NO_CAST_TO_ASCII
-    if (sizeof(typename QConcatenable< QStringBuilder<A, B> >::ConvertTo::value_type) == sizeof(QChar)) {
-        //it is not save to optimize as in utf8 it is not possible to compute the size
-        return a += QString(b).toUtf8();
-    }
-#endif
-    int len = a.size() + QConcatenable< QStringBuilder<A, B> >::size(b);
-    a.reserve(len);
-    char *it = a.data() + a.size();
-    QConcatenable< QStringBuilder<A, B> >::appendTo(b, it);
-    a.resize(len); //we need to resize after the appendTo for the case str+=foo+str
-    return a;
-}
-
-template <typename A, typename B>
-QString &operator+=(QString &a, const QStringBuilder<A, B> &b)
-{
-    int len = a.size() + QConcatenable< QStringBuilder<A, B> >::size(b);
-    a.reserve(len);
-    QChar *it = a.data() + a.size();
-    QConcatenable< QStringBuilder<A, B> >::appendTo(b, it);
-    a.resize(it - a.constData()); //may be smaller than len if there was conversion from utf8
-    return a;
-}
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSTRINGBUILDER_H
index d187a53..8b064d2 100644 (file)
@@ -39,7 +39,6 @@ set(CORE_HEADERS
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qsize.h
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qstack.h
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qstring.h
-    ${CMAKE_CURRENT_SOURCE_DIR}/tools/qstringbuilder.h
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qstringlist.h
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qstringmatcher.h
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qtextboundaryfinder.h
@@ -80,7 +79,6 @@ set(CORE_SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qsharedpointer.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qsize.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qstring.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/tools/qstringbuilder.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qstringlist.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qtextboundaryfinder.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/tools/qtimeline.cpp
index d3c2370..86ed970 100644 (file)
@@ -253,16 +253,16 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
         actualSize.scale(size, Qt::KeepAspectRatio);
 
     QString key = QLatin1String("qt_")
-                  % HexString<quint64>(pm.cacheKey())
-                  % HexString<uint>(pe->mode)
-                  % HexString<quint64>(QApplication::palette().cacheKey())
-                  % HexString<uint>(actualSize.width())
-                  % HexString<uint>(actualSize.height());
+                  + HexString<quint64>(pm.cacheKey())
+                  + HexString<uint>(pe->mode)
+                  + HexString<quint64>(QApplication::palette().cacheKey())
+                  + HexString<uint>(actualSize.width())
+                  + HexString<uint>(actualSize.height());
 
     if (mode == QIcon::Active) {
-        if (QPixmapCache::find(key % HexString<uint>(mode), pm))
+        if (QPixmapCache::find(key + HexString<uint>(mode), pm))
             return pm; // horray
-        if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) {
+        if (QPixmapCache::find(key + HexString<uint>(QIcon::Normal), pm)) {
             QStyleOption opt(0);
             opt.palette = QApplication::palette();
             QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt);
@@ -271,7 +271,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
         }
     }
 
-    if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) {
+    if (!QPixmapCache::find(key + HexString<uint>(mode), pm)) {
         if (pm.size() != actualSize)
             pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
         if (pe->mode != mode && mode != QIcon::Normal) {
@@ -281,7 +281,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
             if (!generated.isNull())
                 pm = generated;
         }
-        QPixmapCache::insert(key % HexString<uint>(mode), pm);
+        QPixmapCache::insert(key + HexString<uint>(mode), pm);
     }
     return pm;
 }
index ffb34d8..d793ff4 100644 (file)
@@ -462,10 +462,10 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
     int actualSize = qMin(size.width(), size.height());
 
     QString key = QLatin1String("$qt_theme_")
-                  % HexString<qint64>(basePixmap.cacheKey())
-                  % HexString<int>(mode)
-                  % HexString<qint64>(qApp->palette().cacheKey())
-                  % HexString<int>(actualSize);
+                  + HexString<qint64>(basePixmap.cacheKey())
+                  + HexString<int>(mode)
+                  + HexString<qint64>(qApp->palette().cacheKey())
+                  + HexString<int>(actualSize);
 
     QPixmap cachedPixmap;
     if (QPixmapCache::find(key, &cachedPixmap)) {
index 89cacc0..7d3cf36 100644 (file)
@@ -754,10 +754,10 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
 
     QFileInfo info(fileName);
     QString key = QLatin1String("qt_pixmap")
-                  % info.absoluteFilePath()
-                  % HexString<uint>(info.lastModified().toTime_t())
-                  % HexString<quint64>(info.size())
-                  % HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType);
+                  + info.absoluteFilePath()
+                  + HexString<uint>(info.lastModified().toTime_t())
+                  + HexString<quint64>(info.size())
+                  + HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType);
 
     // Note: If no extension is provided, we try to match the
     // file against known plugin extensions
index 9a98ad4..6dad962 100644 (file)
@@ -101,8 +101,8 @@ QPixmap qt_pixmapForBrush(int brushStyle, bool invert)
 
     QPixmap pm;
     QString key = QLatin1String("$qt-brush$")
-                  % HexString<uint>(brushStyle)
-                  % QLatin1Char(invert ? '1' : '0');
+                  + HexString<uint>(brushStyle)
+                  + QLatin1Char(invert ? '1' : '0');
     if (!QPixmapCache::find(key, pm)) {
         pm = QBitmap::fromData(QSize(8, 8), qt_patternForBrush(brushStyle, invert),
                                QImage::Format_MonoLSB);
index 3f6bde6..bdc15eb 100644 (file)
@@ -195,8 +195,8 @@ static QPixmap qt_patternForAlpha(uchar alpha, int screen)
 {
     QPixmap pm;
     QString key = QLatin1String("$qt-alpha-brush$")
-                  % HexString<uchar>(alpha)
-                  % HexString<int>(screen);
+                  + HexString<uchar>(alpha)
+                  + HexString<int>(screen);
 
     if (!QPixmapCache::find(key, pm)) {
         // #### why not use a mono image here????
index feff89f..5f6b6d1 100644 (file)
@@ -5519,8 +5519,8 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
     const qreal radiusBase = qMax(qreal(1), maxRadius);
 
     QString key = QLatin1String("WaveUnderline-")
-                  % pen.color().name()
-                  % HexString<qreal>(radiusBase);
+                  + pen.color().name()
+                  + HexString<qreal>(radiusBase);
 
     QPixmap pixmap;
     if (QPixmapCache::find(key, pixmap))
index 4e14a80..07579b0 100644 (file)
@@ -485,8 +485,8 @@ static void qBrushSetAlphaF(QBrush *brush, qreal alpha)
         QPixmap texture = brush->texture();
         QPixmap pixmap;
         QString name = QLatin1String("qbrushtexture-alpha")
-                       % HexString<qreal>(alpha)
-                       % HexString<qint64>(texture.cacheKey());
+                       + HexString<qreal>(alpha)
+                       + HexString<qint64>(texture.cacheKey());
         if (!QPixmapCache::find(name, pixmap)) {
             QImage image = texture.toImage();
             QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
@@ -548,8 +548,8 @@ static QBrush qBrushLight(QBrush brush, int light)
         QPixmap texture = brush.texture();
         QPixmap pixmap;
         QString name = QLatin1String("qbrushtexture-light")
-                       % HexString<int>(light)
-                       % HexString<qint64>(texture.cacheKey());
+                       + HexString<int>(light)
+                       + HexString<qint64>(texture.cacheKey());
 
         if (!QPixmapCache::find(name, pixmap)) {
             QImage image = texture.toImage();
@@ -610,8 +610,8 @@ static QBrush qBrushDark(QBrush brush, int dark)
         QPixmap texture = brush.texture();
         QPixmap pixmap;
         QString name = QLatin1String("qbrushtexture-dark")
-                       % HexString<int>(dark)
-                       % HexString<qint64>(texture.cacheKey());
+                       + HexString<int>(dark)
+                       + HexString<qint64>(texture.cacheKey());
 
         if (!QPixmapCache::find(name, pixmap)) {
             QImage image = texture.toImage();
@@ -727,10 +727,10 @@ static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, con
                                        const QColor &gradientStop)
 {
     QString gradientName = QLatin1String("qplastique-g")
-                   % HexString<int>(rect.width())
-                   % HexString<int>(rect.height())
-                   % HexString<QRgb>(gradientStart.rgba())
-                   % HexString<QRgb>(gradientStop.rgba());
+                   + HexString<int>(rect.width())
+                   + HexString<int>(rect.height())
+                   + HexString<QRgb>(gradientStart.rgba())
+                   + HexString<QRgb>(gradientStop.rgba());
 
     QPixmap cache;
     QPainter *p = painter;
index 8654e66..ca67720 100644 (file)
 <file>images/media-volume-16.png</file>
 <file>images/media-volume-muted-16.png</file>
 </qresource>
-<qresource prefix="/trolltech/styles/macstyle">
-<file>images/closedock-16.png</file>
-<file>images/closedock-down-16.png</file>
-<file>images/dockdock-16.png</file>
-<file>images/dockdock-down-16.png</file>
-</qresource>
 </RCC>
index 934a77d..0e73476 100644 (file)
@@ -55,18 +55,18 @@ namespace QStyleHelper {
 QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
 {
     const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
-    QString tmp = key % HexString<uint>(option->state)
-                      % HexString<uint>(option->direction)
-                      % HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
-                      % HexString<quint64>(option->palette.cacheKey())
-                      % HexString<uint>(size.width())
-                      % HexString<uint>(size.height());
+    QString tmp = key + HexString<uint>(option->state)
+                      + HexString<uint>(option->direction)
+                      + HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
+                      + HexString<quint64>(option->palette.cacheKey())
+                      + HexString<uint>(size.width())
+                      + HexString<uint>(size.height());
 
 #ifndef QT_NO_SPINBOX
     if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
-        tmp = tmp % HexString<uint>(spinBox->buttonSymbols)
-                  % HexString<uint>(spinBox->stepEnabled)
-                  % QLatin1Char(spinBox->frame ? '1' : '0'); ;
+        tmp = tmp + HexString<uint>(spinBox->buttonSymbols)
+                  + HexString<uint>(spinBox->stepEnabled)
+                  + QLatin1Char(spinBox->frame ? '1' : '0'); ;
     }
 #endif // QT_NO_SPINBOX
     return tmp;
index 65223fb..3e40418 100644 (file)
@@ -43,7 +43,6 @@
 #include <QtCore/qpoint.h>
 #include <QtCore/qstring.h>
 #include <QtGui/qpolygon.h>
-#include <QtCore/qstringbuilder.h>
 
 #ifndef QSTYLEHELPER_P_H
 #define QSTYLEHELPER_P_H
@@ -88,30 +87,13 @@ template <typename T>
         : val(t)
     {}
 
-    inline void write(QChar *&dest) const
-    {
-        const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+    operator const QChar() const {
         const char *c = reinterpret_cast<const char *>(&val);
-        for (uint i = 0; i < sizeof(T); ++i) {
-            *dest++ = hexChars[*c & 0xf];
-            *dest++ = hexChars[(*c & 0xf0) >> 4];
-            ++c;
-        }
+        return QChar(qChecksum(c ,sizeof(T)));
     }
     const T val;
 };
 
-// specialization to enable fast concatenating of our string tokens to a string
-template <typename T>
-        struct QConcatenable<HexString<T> >
-{
-    typedef HexString<T> type;
-    enum { ExactSize = true };
-    static int size(const HexString<T> &) { return sizeof(T) * 2; }
-    static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
-    typedef QString ConvertTo;
-};
-
 QT_END_NAMESPACE
 
 #endif // QSTYLEHELPER_P_H
index fe4c623..6aaed7b 100644 (file)
@@ -919,8 +919,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
             int size = qMin(r.height(), r.width());
             QPixmap pixmap;
             QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-")
-                                                          % QLatin1String(metaObject()->className()), opt, QSize(size, size))
-                                 % HexString<uint>(pe);
+                                + QLatin1String(metaObject()->className()), opt, QSize(size, size))
+                                + HexString<uint>(pe);
             if (!QPixmapCache::find(pixmapName, pixmap)) {
                 int border = size/5;
                 int sqsize = 2*(size/2);
index e30b0df..61c493b 100644 (file)
@@ -63,7 +63,6 @@ static const ClassInfoEntry qclass_lib_map[] = {
     { "QLatin1String", "QtCore/qstring.h"},
     { "QCharRef", "QtCore/qstring.h"},
     { "QStringRef", "QtCore/qstring.h"},
-    { "QAbstractConcatenable", "QtCore/qstringbuilder.h"},
     { "QStringList", "QtCore/qstringlist.h"},
     { "QStringMatcher", "QtCore/qstringmatcher.h"},
     { "QTextBoundaryFinder", "QtCore/qtextboundaryfinder.h"},