diff options
Diffstat (limited to 'plugins/src/codecs/tw')
-rw-r--r-- | plugins/src/codecs/tw/main.cpp | 47 | ||||
-rw-r--r-- | plugins/src/codecs/tw/tw.pro | 18 |
2 files changed, 65 insertions, 0 deletions
diff --git a/plugins/src/codecs/tw/main.cpp b/plugins/src/codecs/tw/main.cpp new file mode 100644 index 0000000..662ef30 --- /dev/null +++ b/plugins/src/codecs/tw/main.cpp @@ -0,0 +1,47 @@ +#include <qtextcodecplugin.h> +#include <qtextcodec.h> +#include <qptrlist.h> + +#include <qbig5codec.h> +#include <private/qfontcodecs_p.h> + + +class TWTextCodecs : public QTextCodecPlugin +{ +public: + TWTextCodecs() {} + + QStringList names() const { return QStringList() << "Big5" << "big5*-0"; } + QValueList<int> mibEnums() const { return QValueList<int>() << 2026 << -2026; } + QTextCodec *createForMib( int ); + QTextCodec *createForName( const QString & ); +}; + +QTextCodec *TWTextCodecs::createForMib( int mib ) +{ + switch (mib) { + case -2026: + return new QFontBig5Codec; + case 2026: + return new QBig5Codec; + default: + ; + } + + return 0; +} + + +QTextCodec *TWTextCodecs::createForName( const QString &name ) +{ + if (name == "Big5") + return new QBig5Codec; + if (name == "big5*-0") + return new QFontBig5Codec; + + return 0; +} + + +Q_EXPORT_PLUGIN( TWTextCodecs ); + diff --git a/plugins/src/codecs/tw/tw.pro b/plugins/src/codecs/tw/tw.pro new file mode 100644 index 0000000..6c705c8 --- /dev/null +++ b/plugins/src/codecs/tw/tw.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib +TARGET = qtwcodecs + +CONFIG += qt warn_on plugin +DESTDIR = ../../../codecs + +REQUIRES = !bigcodecs + +HEADERS = ../../../../include/qbig5codec.h \ + ../../../../include/private/qfontcodecs_p.h +SOURCES = ../../../../src/codecs/qbig5codec.cpp \ + ../../../../src/codecs/qfonttwcodec.cpp \ + main.cpp + + +target.path += $$plugins.path/codecs +INSTALLS += target + |