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>
31
#include <qstringlist.h>
33
#include "qeucjpcodec.h"
34
#include "qjiscodec.h"
35
#include "qsjiscodec.h"
37
#include "qfontjpcodec.h"
40
class JPTextCodecs : public QTextCodecPlugin
45
QList<QByteArray> names() const;
46
QList<QByteArray> aliases() const;
47
QList<int> mibEnums() const;
49
QTextCodec *createForMib(int);
50
QTextCodec *createForName(const QByteArray &);
53
QList<QByteArray> JPTextCodecs::names() const
55
QList<QByteArray> list;
56
list += QEucJpCodec::_name();
57
list += QJisCodec::_name();
58
list += QSjisCodec::_name();
60
list += QFontJis0201Codec::_name();
61
list += QFontJis0208Codec::_name();
66
QList<QByteArray> JPTextCodecs::aliases() const
68
QList<QByteArray> list;
69
list += QEucJpCodec::_aliases();
70
list += QJisCodec::_aliases();
71
list += QSjisCodec::_aliases();
73
list += QFontJis0201Codec::_aliases();
74
list += QFontJis0208Codec::_aliases();
79
QList<int> JPTextCodecs::mibEnums() const
82
list += QEucJpCodec::_mibEnum();
83
list += QJisCodec::_mibEnum();
84
list += QSjisCodec::_mibEnum();
86
list += QFontJis0201Codec::_mibEnum();
87
list += QFontJis0208Codec::_mibEnum();
92
QTextCodec *JPTextCodecs::createForMib(int mib)
94
if (mib == QEucJpCodec::_mibEnum())
95
return new QEucJpCodec;
96
if (mib == QJisCodec::_mibEnum())
98
if (mib == QSjisCodec::_mibEnum())
99
return new QSjisCodec;
101
if (mib == QFontJis0208Codec::_mibEnum())
102
return new QFontJis0208Codec;
103
if (mib == QFontJis0201Codec::_mibEnum())
104
return new QFontJis0201Codec;
110
QTextCodec *JPTextCodecs::createForName(const QByteArray &name)
112
if (name == QEucJpCodec::_name() || QEucJpCodec::_aliases().contains(name))
113
return new QEucJpCodec;
114
if (name == QJisCodec::_name() || QJisCodec::_aliases().contains(name))
115
return new QJisCodec;
116
if (name == QSjisCodec::_name() || QSjisCodec::_aliases().contains(name))
117
return new QSjisCodec;
119
if (name == QFontJis0208Codec::_name() || QFontJis0208Codec::_aliases().contains(name))
120
return new QFontJis0208Codec;
121
if (name == QFontJis0201Codec::_name() || QFontJis0201Codec::_aliases().contains(name))
122
return new QFontJis0201Codec;
128
Q_EXPORT_PLUGIN(JPTextCodecs);