1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the internationalization module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include <qtextcodecplugin.h>
30
#include <qtextcodec.h>
33
#include "qgb18030codec.h"
36
class CNTextCodecs : public QTextCodecPlugin
41
QList<QByteArray> names() const;
42
QList<QByteArray> aliases() const;
43
QList<int> mibEnums() const;
45
QTextCodec *createForMib(int);
46
QTextCodec *createForName(const QByteArray &);
49
QList<QByteArray> CNTextCodecs::names() const
51
QList<QByteArray> list;
52
list += QGb18030Codec::_name();
53
list += QGbkCodec::_name();
54
list += QGb2312Codec::_name();
56
list += QFontGb2312Codec::_name();
57
list += QFontGbkCodec::_name();
62
QList<QByteArray> CNTextCodecs::aliases() const
64
QList<QByteArray> list;
65
list += QGb18030Codec::_aliases();
66
list += QGbkCodec::_aliases();
67
list += QGb2312Codec::_aliases();
69
list += QFontGb2312Codec::_aliases();
70
list += QFontGbkCodec::_aliases();
75
QList<int> CNTextCodecs::mibEnums() const
78
list += QGb18030Codec::_mibEnum();
79
list += QGbkCodec::_mibEnum();
80
list += QGb2312Codec::_mibEnum();
82
list += QFontGb2312Codec::_mibEnum();
83
list += QFontGbkCodec::_mibEnum();
88
QTextCodec *CNTextCodecs::createForMib(int mib)
90
if (mib == QGb18030Codec::_mibEnum())
91
return new QGb18030Codec;
92
if (mib == QGbkCodec::_mibEnum())
94
if (mib == QGb2312Codec::_mibEnum())
95
return new QGb2312Codec;
97
if (mib == QFontGbkCodec::_mibEnum())
98
return new QFontGbkCodec;
99
if (mib == QFontGb2312Codec::_mibEnum())
100
return new QFontGb2312Codec;
106
QTextCodec *CNTextCodecs::createForName(const QByteArray &name)
108
if (name == QGb18030Codec::_name() || QGb18030Codec::_aliases().contains(name))
109
return new QGb18030Codec;
110
if (name == QGbkCodec::_name() || QGbkCodec::_aliases().contains(name))
111
return new QGbkCodec;
112
if (name == QGb2312Codec::_name() || QGb2312Codec::_aliases().contains(name))
113
return new QGb2312Codec;
115
if (name == QFontGbkCodec::_name() || QFontGbkCodec::_aliases().contains(name))
116
return new QFontGbkCodec;
117
if (name == QFontGb2312Codec::_name() || QFontGb2312Codec::_aliases().contains(name))
118
return new QFontGb2312Codec;
124
Q_EXPORT_PLUGIN(CNTextCodecs);