summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/plugins/src/codecs/jp/main.cpp
blob: 8b0f8f94197b92e3ec20d2514fab1cb0754d4f9d (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 <tqtextcodecplugin.h>
#include <tqtextcodec.h>
#include <tqptrlist.h>

#include <tqeucjpcodec.h>
#include <tqjiscodec.h>
#include <tqsjiscodec.h>
#include <private/tqfontcodecs_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;
}


TQ_EXPORT_PLUGIN( JPTextCodecs );