summaryrefslogtreecommitdiffstats
path: root/plugins/src/codecs/tw/main.cpp
blob: 662ef30a4b5603a1b2fc579f60c7d3b2a5aa515d (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
#include <qtextcodecplugin.h>
#include <qtextcodec.h>
#include <qptrlist.h>

#include <qbig5codec.h>
#include <private/qfontcodecs_p.h>


class TWTextCodecs : public QTextCodecPlugin
{
public:
    TWTextCodecs() {}
    
    QStringList names() const { return QStringList() << "Big5" << "big5*-0"; }
    QValueList<int> mibEnums() const { return QValueList<int>() << 2026 << -2026; }
    QTextCodec *createForMib( int );
    QTextCodec *createForName( const QString & );
};

QTextCodec *TWTextCodecs::createForMib( int mib )
{
    switch (mib) {
    case -2026:
	return new QFontBig5Codec;
    case 2026:
	return new QBig5Codec;
    default:
	;
    }

    return 0;
}


QTextCodec *TWTextCodecs::createForName( const QString &name )
{
    if (name == "Big5")
	return new QBig5Codec;
    if (name == "big5*-0")
	return new QFontBig5Codec;

    return 0;
}


Q_EXPORT_PLUGIN( TWTextCodecs );