remove obsolete codec plugin loading code
authorMark Brand <mabrand@mabrand.nl>
Thu, 12 Jan 2012 09:43:29 +0000 (10:43 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 20 Jan 2012 17:48:22 +0000 (18:48 +0100)
Change-Id: I1f3dbb5c10009413f701947b1b89ed3dbc94bf3d
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
dist/changes-5.0.0
src/corelib/codecs/codecs.pri
src/corelib/codecs/qtextcodec.cpp
src/corelib/codecs/qtextcodecplugin.cpp [deleted file]
src/corelib/codecs/qtextcodecplugin.h [deleted file]
src/corelib/global/qconfig-medium.h
src/corelib/global/qconfig-minimal.h
src/corelib/global/qconfig-nacl.h
src/corelib/global/qconfig-small.h
src/corelib/global/qfeatures.h

index b0f9693..1ec68fc 100644 (file)
@@ -171,6 +171,8 @@ information about a particular change.
 - qmake
   * several functions and built-in variables were modified to return normalized paths.
 
+- QTextCodecPlugin has been removed since it is no longer used. All text codecs
+  are now built into QtCore.
 
 ****************************************************************************
 *                           General                                        *
@@ -338,7 +340,7 @@ Qt for Windows CE
 ****************************************************************************
 *                          Plugins                                         *
 ****************************************************************************
-
+- The text codecs that were previously plugins are now built into QtCore.
 
 ****************************************************************************
 *                   Important Behavior Changes                             *
index 0478ecf..d0bafc3 100644 (file)
@@ -8,7 +8,6 @@ HEADERS += \
     codecs/qtextcodec.h \
     codecs/qtsciicodec_p.h \
     codecs/qutfcodec_p.h \
-    codecs/qtextcodecplugin.h \
     codecs/qgb18030codec_p.h \
     codecs/qeucjpcodec_p.h \
     codecs/qjiscodec_p.h \
@@ -24,7 +23,6 @@ SOURCES += \
     codecs/qtextcodec.cpp \
     codecs/qtsciicodec.cpp \
     codecs/qutfcodec.cpp \
-    codecs/qtextcodecplugin.cpp \
     codecs/qgb18030codec.cpp \
     codecs/qjpunicode.cpp \
     codecs/qeucjpcodec.cpp \
index 2d142cc..ce118f7 100644 (file)
 
 #include "qlist.h"
 #include "qfile.h"
-#ifndef QT_NO_LIBRARY
-# include "qcoreapplication.h"
-# include "qtextcodecplugin.h"
-# include "private/qfactoryloader_p.h"
-#endif
 #include "qstringlist.h"
 
 #ifdef Q_OS_UNIX
 
 QT_BEGIN_NAMESPACE
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
-    (QTextCodecFactoryInterface_iid, QLatin1String("/codecs")))
-#endif
-
 //Cache for QTextCodec::codecForName and codecForMib.
 typedef QHash<QByteArray, QTextCodec *> QTextCodecCache;
 Q_GLOBAL_STATIC(QTextCodecCache, qTextCodecCache)
@@ -146,39 +136,6 @@ static bool nameMatch(const QByteArray &name, const QByteArray &test)
 }
 
 
-static QTextCodec *createForName(const QByteArray &name)
-{
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
-    QFactoryLoader *l = loader();
-    QStringList keys = l->keys();
-    for (int i = 0; i < keys.size(); ++i) {
-        if (nameMatch(name, keys.at(i).toLatin1())) {
-            QString realName = keys.at(i);
-            if (QTextCodecFactoryInterface *factory
-                = qobject_cast<QTextCodecFactoryInterface*>(l->instance(realName))) {
-                return factory->create(realName);
-            }
-        }
-    }
-#else
-    Q_UNUSED(name);
-#endif
-    return 0;
-}
-
-static QTextCodec *createForMib(int mib)
-{
-#ifndef QT_NO_TEXTCODECPLUGIN
-    QString name = QLatin1String("MIB: ") + QString::number(mib);
-    if (QTextCodecFactoryInterface *factory
-        = qobject_cast<QTextCodecFactoryInterface*>(loader()->instance(name)))
-        return factory->create(name);
-#else
-    Q_UNUSED(mib);
-#endif
-    return 0;
-}
-
 static QList<QTextCodec*> *all = 0;
 #ifdef Q_DEBUG_TEXTCODEC
 static bool destroying_is_ok = false;
@@ -936,10 +893,6 @@ QTextCodec::ConverterState::~ConverterState()
          \o Converts a Unicode string to an 8-bit character string.
     \endtable
 
-    You may find it more convenient to make your codec class
-    available as a plugin; see \l{How to Create Qt Plugins} for
-    details.
-
     \sa QTextStream, QTextDecoder, QTextEncoder, {Codecs Example}
 */
 
@@ -1032,10 +985,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
             }
     }
 
-    codec = createForName(name);
-    if (codec && cache)
-        cache->insert(name, codec);
-    return codec;
+    return 0;
 }
 
 
@@ -1072,16 +1022,7 @@ QTextCodec* QTextCodec::codecForMib(int mib)
         }
     }
 
-    codec = createForMib(mib);
-
-    // Qt 3 used 1000 (mib for UCS2) as its identifier for the utf16 codec. Map
-    // this correctly for compatibility.
-    if (!codec && mib == 1000)
-        return codecForMib(1015);
-
-    if (codec && cache)
-        cache->insert(key, codec);
-    return codec;
+    return 0;
 }
 
 /*!
@@ -1114,18 +1055,6 @@ QList<QByteArray> QTextCodec::availableCodecs()
     locker.unlock();
 #endif
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
-    QFactoryLoader *l = loader();
-    QStringList keys = l->keys();
-    for (int i = 0; i < keys.size(); ++i) {
-        if (!keys.at(i).startsWith(QLatin1String("MIB: "))) {
-            QByteArray name = keys.at(i).toLatin1();
-            if (!codecs.contains(name))
-                codecs += name;
-        }
-    }
-#endif
-
     return codecs;
 }
 
@@ -1154,18 +1083,6 @@ QList<int> QTextCodec::availableMibs()
     locker.unlock();
 #endif
 
-#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
-    QFactoryLoader *l = loader();
-    QStringList keys = l->keys();
-    for (int i = 0; i < keys.size(); ++i) {
-        if (keys.at(i).startsWith(QLatin1String("MIB: "))) {
-            int mib = keys.at(i).mid(5).toInt();
-            if (!codecs.contains(mib))
-                codecs += mib;
-        }
-    }
-#endif
-
     return codecs;
 }
 
diff --git a/src/corelib/codecs/qtextcodecplugin.cpp b/src/corelib/codecs/qtextcodecplugin.cpp
deleted file mode 100644 (file)
index 4eb075c..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtextcodecplugin.h"
-#include "qstringlist.h"
-
-#ifndef QT_NO_TEXTCODECPLUGIN
-
-QT_BEGIN_NAMESPACE
-
-/*!
-    \class QTextCodecPlugin
-    \brief The QTextCodecPlugin class provides an abstract base for custom QTextCodec plugins.
-    \reentrant
-    \ingroup plugins
-
-    The text codec plugin is a simple plugin interface that makes it
-    easy to create custom text codecs that can be loaded dynamically
-    into applications.
-
-    Writing a text codec plugin is achieved by subclassing this base
-    class, reimplementing the pure virtual functions names(),
-    aliases(), createForName(), mibEnums() and createForMib(), and
-    exporting the class with the Q_EXPORT_PLUGIN2() macro. See \l{How
-    to Create Qt Plugins} for details.
-
-    See the \l{http://www.iana.org/assignments/character-sets}{IANA
-    character-sets encoding file} for more information on mime
-    names and mib enums.
-*/
-
-/*!
-    \fn QStringList QTextCodecPlugin::names() const
-
-    Returns the list of MIME names supported by this plugin.
-
-    If a codec has several names, the extra names are returned by aliases().
-
-    \sa createForName(), aliases()
-*/
-
-/*!
-    \fn QList<QByteArray> QTextCodecPlugin::aliases() const
-
-    Returns the list of aliases supported by this plugin.
-*/
-
-/*!
-    \fn QTextCodec *QTextCodecPlugin::createForName(const QByteArray &name)
-
-    Creates a QTextCodec object for the codec called \a name. The \a name
-    must come from the list of encodings returned by names(). Encoding
-    names are case sensitive.
-
-    Example:
-
-    \snippet doc/src/snippets/code/src_corelib_codecs_qtextcodecplugin.cpp 0
-
-    \sa names()
-*/
-
-
-/*!
-    \fn QList<int> QTextCodecPlugin::mibEnums() const
-
-    Returns the list of mib enums supported by this plugin.
-
-    \sa createForMib()
-*/
-
-/*!
-    \fn QTextCodec *QTextCodecPlugin::createForMib(int mib);
-
-    Creates a QTextCodec object for the mib enum \a mib.
-
-    See \l{http://www.iana.org/assignments/character-sets}{the
-    IANA character-sets encoding file} for more information.
-
-    \sa mibEnums()
-*/
-
-/*!
-    Constructs a text codec plugin with the given \a parent. This is
-    invoked automatically by the Q_EXPORT_PLUGIN2() macro.
-*/
-QTextCodecPlugin::QTextCodecPlugin(QObject *parent)
-    : QObject(parent)
-{
-}
-
-/*!
-    Destroys the text codec plugin.
-
-    You never have to call this explicitly. Qt destroys a plugin
-    automatically when it is no longer used.
-*/
-QTextCodecPlugin::~QTextCodecPlugin()
-{
-}
-
-QStringList QTextCodecPlugin::keys() const
-{
-    QStringList keys;
-    QList<QByteArray> list = names();
-    list += aliases();
-    for (int i = 0; i < list.size(); ++i)
-        keys += QString::fromLatin1(list.at(i));
-    QList<int> mibs = mibEnums();
-    for (int i = 0; i < mibs.count(); ++i)
-        keys += QLatin1String("MIB: ") + QString::number(mibs.at(i));
-    return keys;
-}
-
-QTextCodec *QTextCodecPlugin::create(const QString &name)
-{
-    if (name.startsWith(QLatin1String("MIB: ")))
-        return createForMib(name.mid(4).toInt());
-    return createForName(name.toLatin1());
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTCODECPLUGIN
diff --git a/src/corelib/codecs/qtextcodecplugin.h b/src/corelib/codecs/qtextcodecplugin.h
deleted file mode 100644 (file)
index 9a00bbc..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTEXTCODECPLUGIN_H
-#define QTEXTCODECPLUGIN_H
-
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qbytearray.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Core)
-
-#ifndef QT_NO_TEXTCODECPLUGIN
-
-class QTextCodec;
-
-struct Q_CORE_EXPORT QTextCodecFactoryInterface : public QFactoryInterface
-{
-    virtual QTextCodec *create(const QString &key) = 0;
-};
-
-#define QTextCodecFactoryInterface_iid "com.trolltech.Qt.QTextCodecFactoryInterface"
-
-Q_DECLARE_INTERFACE(QTextCodecFactoryInterface, QTextCodecFactoryInterface_iid)
-
-
-class Q_CORE_EXPORT QTextCodecPlugin : public QObject, public QTextCodecFactoryInterface
-{
-    Q_OBJECT
-    Q_INTERFACES(QTextCodecFactoryInterface:QFactoryInterface)
-public:
-    explicit QTextCodecPlugin(QObject *parent = 0);
-    ~QTextCodecPlugin();
-
-    virtual QList<QByteArray> names() const = 0;
-    virtual QList<QByteArray> aliases() const = 0;
-    virtual QTextCodec *createForName(const QByteArray &name) = 0;
-
-    virtual QList<int> mibEnums() const = 0;
-    virtual QTextCodec *createForMib(int mib) = 0;
-
-private:
-    QStringList keys() const;
-    QTextCodec *create(const QString &name);
-};
-
-#endif // QT_NO_TEXTCODECPLUGIN
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTEXTCODECPLUGIN_H
index 96207d1..779d4ef 100644 (file)
@@ -91,9 +91,6 @@
 #ifndef QT_NO_CODECS
 #  define QT_NO_CODECS
 #endif
-#ifndef QT_NO_TEXTCODECPLUGIN
-#  define QT_NO_TEXTCODECPLUGIN
-#endif
 #ifndef QT_NO_TRANSLATION
 #  define QT_NO_TRANSLATION
 #endif
index 3044024..29f7779 100644 (file)
 #ifndef QT_NO_CODECS
 #  define QT_NO_CODECS
 #endif
-#ifndef QT_NO_TEXTCODECPLUGIN
-#  define QT_NO_TEXTCODECPLUGIN
-#endif
 #ifndef QT_NO_TRANSLATION
 #  define QT_NO_TRANSLATION
 #endif
index 6b943ab..45f012f 100644 (file)
 #ifndef QT_NO_CODECS
 #  define QT_NO_CODECS
 #endif
-#ifndef QT_NO_TEXTCODECPLUGIN
-#  define QT_NO_TEXTCODECPLUGIN
-#endif
 #ifndef QT_NO_TRANSLATION
 #  define QT_NO_TRANSLATION
 #endif
index 84a5ec5..18dd051 100644 (file)
 #ifndef QT_NO_CODECS
 #  define QT_NO_CODECS
 #endif
-#ifndef QT_NO_TEXTCODECPLUGIN
-#  define QT_NO_TEXTCODECPLUGIN
-#endif
 #ifndef QT_NO_TRANSLATION
 #  define QT_NO_TRANSLATION
 #endif
index 5055414..c039f15 100644 (file)
 #define QT_NO_TABDIALOG
 #endif
 
-// QTextCodecPlugin
-#if !defined(QT_NO_TEXTCODECPLUGIN) && (defined(QT_NO_TEXTCODEC) || defined(QT_NO_LIBRARY))
-#define QT_NO_TEXTCODECPLUGIN
-#endif
-
 // QColorDialog
 #if !defined(QT_NO_COLORDIALOG) && (defined(QT_NO_SPINBOX))
 #define QT_NO_COLORDIALOG