summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-09-28 10:33:48 +0200
committerLiang Qi <liang.qi@qt.io>2018-10-12 14:26:27 +0000
commit9c8ca26a4829d5ce810c9653fec3dfe48717f0b1 (patch)
treec04781ac8c8e5f24874838825375ce13d8ca9ec2 /src/corelib
parent4e7b58629a0a431fbd5c0ba287c3958efd05da13 (diff)
Modernize the "codecs" feature
Change-Id: Idee19112581bff64a2e0b8e331dd3d779aca165b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/codecs/codecs.pri14
-rw-r--r--src/corelib/codecs/qicucodec.cpp2
-rw-r--r--src/corelib/codecs/qisciicodec.cpp4
-rw-r--r--src/corelib/codecs/qisciicodec_p.h6
-rw-r--r--src/corelib/codecs/qtextcodec.cpp6
-rw-r--r--src/corelib/codecs/qtsciicodec.cpp4
-rw-r--r--src/corelib/codecs/qtsciicodec_p.h6
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h1
8 files changed, 19 insertions, 24 deletions
diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri
index 5af388a149..d86d446c72 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -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
diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp
index ee9f1d0048..06a6d95e82 100644
--- a/src/corelib/codecs/qicucodec.cpp
+++ b/src/corelib/codecs/qicucodec.cpp
@@ -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))
diff --git a/src/corelib/codecs/qisciicodec.cpp b/src/corelib/codecs/qisciicodec.cpp
index 499e8549a7..d9a86d77c7 100644
--- a/src/corelib/codecs/qisciicodec.cpp
+++ b/src/corelib/codecs/qisciicodec.cpp
@@ -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
diff --git a/src/corelib/codecs/qisciicodec_p.h b/src/corelib/codecs/qisciicodec_p.h
index f818e7d83e..2c1b3ca9e0 100644
--- a/src/corelib/codecs/qisciicodec_p.h
+++ b/src/corelib/codecs/qisciicodec_p.h
@@ -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
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 58fc72c9ce..790921610a 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -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;
diff --git a/src/corelib/codecs/qtsciicodec.cpp b/src/corelib/codecs/qtsciicodec.cpp
index 49f38d1789..936fc4206d 100644
--- a/src/corelib/codecs/qtsciicodec.cpp
+++ b/src/corelib/codecs/qtsciicodec.cpp
@@ -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
diff --git a/src/corelib/codecs/qtsciicodec_p.h b/src/corelib/codecs/qtsciicodec_p.h
index 78f9350a19..9247098e36 100644
--- a/src/corelib/codecs/qtsciicodec_p.h
+++ b/src/corelib/codecs/qtsciicodec_p.h
@@ -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
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index 499fd4c9e8..da66e3bcd3 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -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