drop text codec plugins support

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-02-08 14:48:05 +02:00
parent 247be7d868
commit d263dd92c6
12 changed files with 5 additions and 324 deletions

View file

@ -898,7 +898,6 @@ katie_generate_obsolete(QTextBlockGroup QtGui qtextobject.h)
katie_generate_obsolete(QTextBlock QtGui qtextobject.h)
katie_generate_obsolete(QTextBlockUserData QtGui qtextobject.h)
katie_generate_obsolete(QTextCharFormat QtGui qtextformat.h)
katie_generate_obsolete(QTextCodecFactoryInterface QtCore qtextcodecplugin.h)
katie_generate_obsolete(QTextDecoder QtCore qtextcodec.h)
katie_generate_obsolete(QTextEncoder QtCore qtextcodec.h)
katie_generate_obsolete(QTextFragment QtGui qtextobject.h)

View file

@ -174,8 +174,6 @@ include/katie/QtCore/QSystemSemaphore
include/katie/QtCore/QTemporaryFile
include/katie/QtCore/QTextBoundaryFinder
include/katie/QtCore/QTextCodec
include/katie/QtCore/QTextCodecFactoryInterface
include/katie/QtCore/QTextCodecPlugin
include/katie/QtCore/QTextDecoder
include/katie/QtCore/QTextEncoder
include/katie/QtCore/QTextStream
@ -328,7 +326,6 @@ include/katie/QtCore/qtconcurrentthreadengine.h
include/katie/QtCore/qtemporaryfile.h
include/katie/QtCore/qtextboundaryfinder.h
include/katie/QtCore/qtextcodec.h
include/katie/QtCore/qtextcodecplugin.h
include/katie/QtCore/qtextstream.h
include/katie/QtCore/qthread.h
include/katie/QtCore/qthreadpool.h

View file

@ -177,8 +177,6 @@ include/katie/QtCore/QSystemSemaphore
include/katie/QtCore/QTemporaryFile
include/katie/QtCore/QTextBoundaryFinder
include/katie/QtCore/QTextCodec
include/katie/QtCore/QTextCodecFactoryInterface
include/katie/QtCore/QTextCodecPlugin
include/katie/QtCore/QTextDecoder
include/katie/QtCore/QTextEncoder
include/katie/QtCore/QTextStream
@ -331,7 +329,6 @@ include/katie/QtCore/qtconcurrentthreadengine.h
include/katie/QtCore/qtemporaryfile.h
include/katie/QtCore/qtextboundaryfinder.h
include/katie/QtCore/qtextcodec.h
include/katie/QtCore/qtextcodecplugin.h
include/katie/QtCore/qtextstream.h
include/katie/QtCore/qthread.h
include/katie/QtCore/qthreadpool.h

View file

@ -177,8 +177,6 @@ include/katie/QtCore/QSystemSemaphore
include/katie/QtCore/QTemporaryFile
include/katie/QtCore/QTextBoundaryFinder
include/katie/QtCore/QTextCodec
include/katie/QtCore/QTextCodecFactoryInterface
include/katie/QtCore/QTextCodecPlugin
include/katie/QtCore/QTextDecoder
include/katie/QtCore/QTextEncoder
include/katie/QtCore/QTextStream
@ -331,7 +329,6 @@ include/katie/QtCore/qtconcurrentthreadengine.h
include/katie/QtCore/qtemporaryfile.h
include/katie/QtCore/qtextboundaryfinder.h
include/katie/QtCore/qtextcodec.h
include/katie/QtCore/qtextcodecplugin.h
include/katie/QtCore/qtextstream.h
include/katie/QtCore/qthread.h
include/katie/QtCore/qthreadpool.h

View file

@ -89,7 +89,6 @@ incmap = {
'QStringRef': 'qstring.h',
'QSysInfo': 'qglobal.h',
'QSystemLocale': 'qlocale.h',
'QTextCodecFactoryInterface': 'qtextcodecplugin.h',
'QTextDecoder': 'qtextcodec.h',
'QTextEncoder': 'qtextcodec.h',
'QTextStreamFunction': 'qtextstream.h',

View file

@ -725,8 +725,6 @@ classlist = [
"QTextBrowser",
"QTextCharFormat",
"QTextCodec",
"QTextCodecFactoryInterface",
"QTextCodecPlugin",
"QTextCursor",
"QTextDecoder",
"QTextDocument",

View file

@ -28,7 +28,6 @@ set(CORE_PUBLIC_HEADERS
QtConcurrentMap
QBitArray
QChar
QTextCodecPlugin
QMap
QTextStream
QDebug
@ -121,7 +120,6 @@ set(CORE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodec_p.h
${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodec.h
${CMAKE_CURRENT_SOURCE_DIR}/codecs/qicucodec_p.h
${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodecplugin.h
${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfuture.h
${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfutureinterface.h
${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfuturesynchronizer.h
@ -296,7 +294,6 @@ set(CORE_HEADERS
set(CORE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodec.cpp
${CMAKE_CURRENT_SOURCE_DIR}/codecs/qtextcodecplugin.cpp
${CMAKE_CURRENT_SOURCE_DIR}/codecs/qicucodec.cpp
${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfuture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/concurrent/qfutureinterface.cpp

View file

@ -47,12 +47,6 @@
#include "qhash.h"
#include "qicucodec_p.h"
#ifndef QT_NO_LIBRARY
# include "qcoreapplication.h"
# include "qtextcodecplugin.h"
# include "qfactoryloader_p.h"
#endif
#include <stdlib.h>
#include <ctype.h>
#include <locale.h>
@ -63,11 +57,6 @@
QT_BEGIN_NAMESPACE
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, codecsloader,
(QTextCodecFactoryInterface_iid, QLatin1String("/codecs")))
#endif
static inline bool nameMatch(const QByteArray &name, const QByteArray &name2)
{
return (ucnv_compareNames(name.constData(), name2.constData()) == 0);
@ -549,18 +538,6 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
}
}
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
const QFactoryLoader *l = codecsloader();
foreach (const QString &key, l->keys()) {
if (nameMatch(name, key.toLatin1())) {
if (QTextCodecFactoryInterface *factory
= qobject_cast<QTextCodecFactoryInterface*>(l->instance(key))) {
return factory->create(key);
}
}
}
#endif
foreach(const QByteArray &codec, QIcuCodec::allCodecs()) {
if (nameMatch(name, codec)) {
return new QIcuCodec(name);
@ -589,13 +566,6 @@ QTextCodec* QTextCodec::codecForMib(int mib)
}
}
#ifndef QT_NO_TEXTCODECPLUGIN
QString name = QLatin1String("MIB: ") + QString::number(mib);
if (QTextCodecFactoryInterface *factory
= qobject_cast<QTextCodecFactoryInterface*>(codecsloader()->instance(name)))
return factory->create(name);
#endif
foreach(const int codec, QIcuCodec::allMibs()) {
if (mib == codec) {
return new QIcuCodec(mib);
@ -616,20 +586,9 @@ QTextCodec* QTextCodec::codecForMib(int mib)
*/
QList<QByteArray> QTextCodec::availableCodecs()
{
QList<QByteArray> codecs;
codecs << "System" << QIcuCodec::allCodecs();
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
const QFactoryLoader *l = codecsloader();
foreach (const QString &key, l->keys()) {
if (!key.startsWith(QLatin1String("MIB: "))) {
QByteArray name = key.toLatin1();
if (!codecs.contains(name))
codecs += name;
}
}
#endif
static const QList<QByteArray> codecs = QList<QByteArray>()
<< "System"
<< QIcuCodec::allCodecs();
return codecs;
}
@ -641,20 +600,7 @@ QList<QByteArray> QTextCodec::availableCodecs()
*/
QList<int> QTextCodec::availableMibs()
{
QList<int> codecs;
codecs << QIcuCodec::allMibs();
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_TEXTCODECPLUGIN)
const QFactoryLoader *l = codecsloader();
foreach (const QString &key, l->keys()) {
if (key.startsWith(QLatin1String("MIB: "))) {
int mib = key.mid(5).toInt();
if (!codecs.contains(mib))
codecs += mib;
}
}
#endif
static const QList<int> codecs = QIcuCodec::allMibs();
return codecs;
}

View file

@ -1,158 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie 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.
**
** 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 "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;
foreach (const QByteArray &name, names())
keys += QString::fromLatin1(name.constData());
foreach (const QByteArray &alias, aliases())
keys += QString::fromLatin1(alias.constData());
foreach (const int mib, mibEnums())
keys += QLatin1String("MIB: ") + QString::number(mib);
return keys;
}
QTextCodec *QTextCodecPlugin::create(const QString &name)
{
if (name.startsWith(QLatin1String("MIB: ")))
return createForMib(name.mid(4).toInt());
return createForName(name.toLatin1());
}
#include "moc_qtextcodecplugin.h"
QT_END_NAMESPACE
#endif // QT_NO_TEXTCODECPLUGIN

View file

@ -1,84 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie 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.
**
** 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 QTEXTCODECPLUGIN_H
#define QTEXTCODECPLUGIN_H
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTCODECPLUGIN
class QTextCodec;
struct Q_CORE_EXPORT QTextCodecFactoryInterface : public QFactoryInterface
{
virtual QTextCodec *create(const QString &key) = 0;
};
QT_END_NAMESPACE
#define QTextCodecFactoryInterface_iid "Katie.QTextCodecFactoryInterface"
Q_DECLARE_INTERFACE(QTextCodecFactoryInterface, QTextCodecFactoryInterface_iid)
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QTextCodecPlugin : public QObject, public QTextCodecFactoryInterface
{
Q_OBJECT
Q_INTERFACES(QTextCodecFactoryInterface:QFactoryInterface)
public:
QT_DEPRECATED_CONSTRUCTOR QTextCodecPlugin(QObject *parent = Q_NULLPTR);
~QTextCodecPlugin();
QT_DEPRECATED virtual QList<QByteArray> names() const = 0;
QT_DEPRECATED virtual QList<QByteArray> aliases() const = 0;
QT_DEPRECATED virtual QTextCodec *createForName(const QByteArray &name) = 0;
QT_DEPRECATED virtual QList<int> mibEnums() const = 0;
QT_DEPRECATED virtual QTextCodec *createForMib(int mib) = 0;
private:
QStringList keys() const;
QTextCodec *create(const QString &name);
};
#endif // QT_NO_TEXTCODECPLUGIN
QT_END_NAMESPACE
#endif // QTEXTCODECPLUGIN_H

View file

@ -100,6 +100,7 @@
#define QT_NO_IMAGE_TEXT
#define QT_NO_IMAGEFORMAT_MNG
#define QT_NO_TEXTODFWRITER
#define QT_NO_TEXTCODECPLUGIN
// Not supported, used to bootstrap
#cmakedefine QT_NO_QOBJECT
@ -291,7 +292,6 @@
#cmakedefine QT_NO_TEXTBROWSER
#cmakedefine QT_NO_TEXTCODE
#cmakedefine QT_NO_TEXTCODEC
#cmakedefine QT_NO_TEXTCODECPLUGIN
#cmakedefine QT_NO_TEXTCONTROL
#cmakedefine QT_NO_TEXTDATE
#cmakedefine QT_NO_TEXTEDIT
@ -503,11 +503,6 @@
# define QT_NO_SVG
#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

View file

@ -651,8 +651,6 @@ static const struct ClassTblData {
{ QLatin1String("QTextBrowser"), QLatin1String("QtGui/qtextbrowser.h") },
{ QLatin1String("QTextCharFormat"), QLatin1String("QtGui/qtextformat.h") },
{ QLatin1String("QTextCodec"), QLatin1String("QtCore/qtextcodec.h") },
{ QLatin1String("QTextCodecFactoryInterface"), QLatin1String("QtCore/qtextcodecplugin.h") },
{ QLatin1String("QTextCodecPlugin"), QLatin1String("QtCore/qtextcodecplugin.h") },
{ QLatin1String("QTextCursor"), QLatin1String("QtGui/qtextcursor.h") },
{ QLatin1String("QTextDecoder"), QLatin1String("QtCore/qtextcodec.h") },
{ QLatin1String("QTextDocument"), QLatin1String("QtGui/qtextdocument.h") },