Qt 4.8
main.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include <qtextcodecplugin.h>
43 #include <qtextcodec.h>
44 #include <qstringlist.h>
45 
46 #include "qeuckrcodec.h"
47 
49 
50 #ifndef QT_NO_TEXTCODECPLUGIN
51 
53 {
54 public:
56 
57  QList<QByteArray> names() const;
58  QList<QByteArray> aliases() const;
59  QList<int> mibEnums() const;
60 
63 };
64 
66 {
67  QList<QByteArray> list;
68  list += QEucKrCodec::_name();
69 #ifdef Q_WS_X11
70  list += QFontKsc5601Codec::_name();
71 #endif
72  list += QCP949Codec::_name();
73  return list;
74 }
75 
77 {
78  QList<QByteArray> list;
79  list += QEucKrCodec::_aliases();
80 #ifdef Q_WS_X11
82 #endif
83  list += QCP949Codec::_aliases();
84  return list;
85 }
86 
88 {
89  QList<int> list;
90  list += QEucKrCodec::_mibEnum();
91 #ifdef Q_WS_X11
93 #endif
94  list += QCP949Codec::_mibEnum();
95  return list;
96 }
97 
99 {
100  if (mib == QEucKrCodec::_mibEnum())
101  return new QEucKrCodec;
102 #ifdef Q_WS_X11
103  if (mib == QFontKsc5601Codec::_mibEnum())
104  return new QFontKsc5601Codec;
105 #endif
106  if (mib == QCP949Codec::_mibEnum())
107  return new QCP949Codec;
108  return 0;
109 }
110 
111 
113 {
114  if (name == QEucKrCodec::_name() || QEucKrCodec::_aliases().contains(name))
115  return new QEucKrCodec;
116 #ifdef Q_WS_X11
117  if (name == QFontKsc5601Codec::_name() || QFontKsc5601Codec::_aliases().contains(name))
118  return new QFontKsc5601Codec;
119 #endif
120  if (name == QCP949Codec::_name() || QCP949Codec::_aliases().contains(name))
121  return new QCP949Codec;
122  return 0;
123 }
124 
125 
127 Q_EXPORT_PLUGIN2(qkrcodecs, KRTextCodecs);
128 
129 #endif // QT_NO_TEXTCODECPLUGIN
130 
QList< QByteArray > aliases() const
Returns the list of aliases supported by this plugin.
Definition: main.cpp:76
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QTextCodecPlugin class provides an abstract base for custom QTextCodec plugins.
QTextCodec * createForMib(int)
Creates a QTextCodec object for the mib enum mib.
Definition: main.cpp:98
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static int _mibEnum()
static QByteArray _name()
KRTextCodecs()
Definition: main.cpp:55
Q_EXPORT_PLUGIN2(qjpcodecs, JPTextCodecs)
Q_EXPORT_STATIC_PLUGIN(JPTextCodecs)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
const char * name
int mib
static QByteArray _name()
QList< QByteArray > names() const
Returns the list of MIME names supported by this plugin.
Definition: main.cpp:65
static QByteArray _name()
static int _mibEnum()
static QList< QByteArray > _aliases()
Definition: qeuckrcodec.h:80
The QTextCodec class provides conversions between text encodings.
Definition: qtextcodec.h:62
static QList< QByteArray > _aliases()
Definition: qeuckrcodec.h:112
QList< int > mibEnums() const
Returns the list of mib enums supported by this plugin.
Definition: main.cpp:87
QTextCodec * createForName(const QByteArray &)
Creates a QTextCodec object for the codec called name.
Definition: main.cpp:112
The QCP949Codec class handles encoding and decoding of text in CP949 encoding.
Definition: qeuckrcodec.h:91
static int _mibEnum()
static QList< QByteArray > _aliases()
Definition: qeuckrcodec.h:94