source: trunk/plugins/src/codecs/jp/main.cpp

Last change on this file was 204, checked in by rudi, 14 years ago

Added plugin source code

File size: 1.2 KB
Line 
1#include <qtextcodecplugin.h>
2#include <qtextcodec.h>
3#include <qptrlist.h>
4
5#include <qeucjpcodec.h>
6#include <qjiscodec.h>
7#include <qsjiscodec.h>
8#include <private/qfontcodecs_p.h>
9
10
11class JPTextCodecs : public QTextCodecPlugin
12{
13public:
14 JPTextCodecs() {}
15
16 QStringList names() const { return QStringList() << "eucJP" << "JIS7" << "SJIS" << "jisx0208.1983-0"; }
17 QValueList<int> mibEnums() const { return QValueList<int>() << 16 << 17 << 18 << 63; }
18 QTextCodec *createForMib( int );
19 QTextCodec *createForName( const QString & );
20};
21
22QTextCodec *JPTextCodecs::createForMib( int mib )
23{
24 switch (mib) {
25 case 16:
26 return new QJisCodec;
27 case 17:
28 return new QSjisCodec;
29 case 18:
30 return new QEucJpCodec;
31 case 63:
32 return new QFontJis0208Codec;
33 default:
34 ;
35 }
36
37 return 0;
38}
39
40
41QTextCodec *JPTextCodecs::createForName( const QString &name )
42{
43 if (name == "JIS7")
44 return new QJisCodec;
45 if (name == "SJIS")
46 return new QSjisCodec;
47 if (name == "eucJP")
48 return new QEucJpCodec;
49 if (name == "jisx0208.1983-0")
50 return new QFontJis0208Codec;
51
52 return 0;
53}
54
55
56Q_EXPORT_PLUGIN( JPTextCodecs );
Note: See TracBrowser for help on using the repository browser.