summaryrefslogtreecommitdiffstats
path: root/plugins/src/codecs/jp/main.cpp
blob: 3f71cbc10e2e3657026f4005376d9a5013690b70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <ntqtextcodecplugin.h>
#include <ntqtextcodec.h>
#include <ntqptrlist.h>

#include <ntqeucjpcodec.h>
#include <ntqjiscodec.h>
#include <ntqsjiscodec.h>
#include <private/qfontcodecs_p.h>


class JPTextCodecs : public TQTextCodecPlugin
{
public:
    JPTextCodecs() {}

    TQStringList names() const { return TQStringList() << "eucJP" << "JIS7" << "SJIS" << "jisx0208.1983-0"; }
    TQValueList<int> mibEnums() const { return TQValueList<int>() << 16 << 17 << 18 << 63; }
    TQTextCodec *createForMib( int );
    TQTextCodec *createForName( const TQString & );
};

TQTextCodec *JPTextCodecs::createForMib( int mib )
{
    switch (mib) {
    case 16:
	return new TQJisCodec;
    case 17:
	return new TQSjisCodec;
    case 18:
	return new TQEucJpCodec;
    case 63:
	return new TQFontJis0208Codec;
    default:
	;
    }

    return 0;
}


TQTextCodec *JPTextCodecs::createForName( const TQString &name )
{
    if (name == "JIS7")
	return new TQJisCodec;
    if (name == "SJIS")
	return new TQSjisCodec;
    if (name == "eucJP")
	return new TQEucJpCodec;
    if (name == "jisx0208.1983-0")
	return new TQFontJis0208Codec;

    return 0;
}


Q_EXPORT_PLUGIN( JPTextCodecs );