Modernize the "codecs" feature

Change-Id: Idee19112581bff64a2e0b8e331dd3d779aca165b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Liang Qi 2018-09-28 10:33:48 +02:00
parent 4e7b58629a
commit 9c8ca26a48
8 changed files with 19 additions and 24 deletions

View File

@ -1,22 +1,28 @@
# Qt core library codecs module
HEADERS += \
codecs/qisciicodec_p.h \
codecs/qlatincodec_p.h \
codecs/qsimplecodec_p.h \
codecs/qtextcodec_p.h \
codecs/qtextcodec.h \
codecs/qtsciicodec_p.h \
codecs/qutfcodec_p.h
SOURCES += \
codecs/qisciicodec.cpp \
codecs/qlatincodec.cpp \
codecs/qsimplecodec.cpp \
codecs/qtextcodec.cpp \
codecs/qtsciicodec.cpp \
codecs/qutfcodec.cpp
qtConfig(codecs) {
HEADERS += \
codecs/qisciicodec_p.h \
codecs/qtsciicodec_p.h
SOURCES += \
codecs/qisciicodec.cpp \
codecs/qtsciicodec.cpp
}
qtConfig(icu) {
HEADERS += \
codecs/qicucodec_p.h

View File

@ -373,7 +373,7 @@ static QTextCodec *loadQtCodec(const char *name)
return new QUtf32LECodec;
if (!strcmp(name, "ISO-8859-16") || !strcmp(name, "latin10") || !strcmp(name, "iso-ir-226"))
return new QSimpleTextCodec(13 /* == 8859-16*/);
#ifndef QT_NO_CODECS
#if QT_CONFIG(codecs)
if (!strcmp(name, "TSCII"))
return new QTsciiCodec;
if (!qstrnicmp(name, "iscii", 5))

View File

@ -40,8 +40,6 @@
#include "qtextcodec_p.h"
#include "qlist.h"
#ifndef QT_NO_CODECS
QT_BEGIN_NAMESPACE
/*!
@ -291,5 +289,3 @@ QString QIsciiCodec::convertToUnicode(const char* chars, int len, ConverterState
}
QT_END_NAMESPACE
#endif // QT_NO_CODECS

View File

@ -54,9 +54,9 @@
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(codecs);
#ifndef QT_NO_CODECS
QT_BEGIN_NAMESPACE
class QIsciiCodec : public QTextCodec {
public:
@ -75,8 +75,6 @@ private:
int idx;
};
#endif // QT_NO_CODECS
QT_END_NAMESPACE
#endif // QISCIICODEC_P_H

View File

@ -57,8 +57,10 @@
#include "qlatincodec_p.h"
#if !defined(QT_BOOTSTRAPPED)
#if QT_CONFIG(codecs)
# include "qtsciicodec_p.h"
# include "qisciicodec_p.h"
#endif
#if QT_CONFIG(icu)
#include "qicucodec_p.h"
#else
@ -268,7 +270,7 @@ static void setup()
return;
initialized = true;
#if !defined(QT_NO_CODECS) && !defined(QT_BOOTSTRAPPED)
#if QT_CONFIG(codecs) && !defined(QT_BOOTSTRAPPED)
(void)new QTsciiCodec;
for (int i = 0; i < 9; ++i)
(void)new QIsciiCodec(i);
@ -293,7 +295,7 @@ static void setup()
#if defined(Q_OS_WIN32)
(void) new QWindowsLocalCodec;
#endif // Q_OS_WIN32
#endif // !QT_NO_CODECS && !QT_BOOTSTRAPPED
#endif // codecs && !QT_BOOTSTRAPPED
(void)new QUtf16Codec;
(void)new QUtf16BECodec;

View File

@ -44,8 +44,6 @@
#include "qtsciicodec_p.h"
#include "qlist.h"
#ifndef QT_NO_CODECS
QT_BEGIN_NAMESPACE
static unsigned char qt_UnicodeToTSCII(ushort u1, ushort u2, ushort u3);
@ -493,5 +491,3 @@ static unsigned int qt_TSCIIToUnicode(uint code, uint *s)
}
QT_END_NAMESPACE
#endif // QT_NO_CODECS

View File

@ -83,9 +83,9 @@
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(codecs);
#ifndef QT_NO_CODECS
QT_BEGIN_NAMESPACE
class QTsciiCodec : public QTextCodec {
public:
@ -98,8 +98,6 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
#endif // QT_NO_CODECS
QT_END_NAMESPACE
#endif // QTSCIICODEC_P_H

View File

@ -130,7 +130,6 @@
#define QT_NO_TEXTCODEC
#define QT_FEATURE_textcodec -1
#else
#define QT_NO_CODECS
#define QT_FEATURE_codecs -1
#define QT_FEATURE_commandlineparser 1
#define QT_FEATURE_textcodec 1