diff options
Diffstat (limited to 'plugins/src/codecs/jp')
-rw-r--r-- | plugins/src/codecs/jp/jp.pro | 25 | ||||
-rw-r--r-- | plugins/src/codecs/jp/main.cpp | 56 |
2 files changed, 81 insertions, 0 deletions
diff --git a/plugins/src/codecs/jp/jp.pro b/plugins/src/codecs/jp/jp.pro new file mode 100644 index 0000000..5968754 --- /dev/null +++ b/plugins/src/codecs/jp/jp.pro @@ -0,0 +1,25 @@ +TEMPLATE = lib +TARGET = qjpcodecs + +CONFIG += qt warn_on plugin +DESTDIR = ../../../codecs + +REQUIRES = !bigcodecs + +HEADERS = ../../../../include/qeucjpcodec.h \ + ../../../../include/qjiscodec.h \ + ../../../../include/qsjiscodec.h \ + ../../../../include/qjpunicode.h \ + ../../../../include/private/qfontcodecs_p.h + +SOURCES = ../../../../src/codecs/qeucjpcodec.cpp \ + ../../../../src/codecs/qjiscodec.cpp \ + ../../../../src/codecs/qsjiscodec.cpp \ + ../../../../src/codecs/qjpunicode.cpp \ + ../../../../src/codecs/qfontjpcodec.cpp \ + main.cpp + + +target.path += $$plugins.path/codecs +INSTALLS += target + diff --git a/plugins/src/codecs/jp/main.cpp b/plugins/src/codecs/jp/main.cpp new file mode 100644 index 0000000..c7ed27c --- /dev/null +++ b/plugins/src/codecs/jp/main.cpp @@ -0,0 +1,56 @@ +#include <qtextcodecplugin.h> +#include <qtextcodec.h> +#include <qptrlist.h> + +#include <qeucjpcodec.h> +#include <qjiscodec.h> +#include <qsjiscodec.h> +#include <private/qfontcodecs_p.h> + + +class JPTextCodecs : public QTextCodecPlugin +{ +public: + JPTextCodecs() {} + + QStringList names() const { return QStringList() << "eucJP" << "JIS7" << "SJIS" << "jisx0208.1983-0"; } + QValueList<int> mibEnums() const { return QValueList<int>() << 16 << 17 << 18 << 63; } + QTextCodec *createForMib( int ); + QTextCodec *createForName( const QString & ); +}; + +QTextCodec *JPTextCodecs::createForMib( int mib ) +{ + switch (mib) { + case 16: + return new QJisCodec; + case 17: + return new QSjisCodec; + case 18: + return new QEucJpCodec; + case 63: + return new QFontJis0208Codec; + default: + ; + } + + return 0; +} + + +QTextCodec *JPTextCodecs::createForName( const QString &name ) +{ + if (name == "JIS7") + return new QJisCodec; + if (name == "SJIS") + return new QSjisCodec; + if (name == "eucJP") + return new QEucJpCodec; + if (name == "jisx0208.1983-0") + return new QFontJis0208Codec; + + return 0; +} + + +Q_EXPORT_PLUGIN( JPTextCodecs ); |