summaryrefslogtreecommitdiffstats
path: root/plugins/src/codecs/jp/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/src/codecs/jp/main.cpp')
-rw-r--r--plugins/src/codecs/jp/main.cpp56
1 files changed, 56 insertions, 0 deletions
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 );