libkdepim
qutf7codecplugin.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "qutf7codec.h"
00026
00027 #include <qtextcodecplugin.h>
00028 #include <qstring.h>
00029 #include <qstringlist.h>
00030 #include <qvaluelist.h>
00031
00032 class QTextCodec;
00033
00034
00035
00036 class QUtf7CodecPlugin : public QTextCodecPlugin {
00037 public:
00038 QUtf7CodecPlugin() {}
00039
00040 QStringList names() const { return QStringList() << "UTF-7" << "X-QT-UTF-7-STRICT"; }
00041 QValueList<int> mibEnums() const { return QValueList<int>() << 1012 << -1012; }
00042 QTextCodec * createForMib( int );
00043 QTextCodec * createForName( const QString & );
00044 };
00045
00046 QTextCodec * QUtf7CodecPlugin::createForMib( int mib ) {
00047 if ( mib == 1012 )
00048 return new QUtf7Codec();
00049 else if ( mib == -1012 )
00050 return new QStrictUtf7Codec();
00051 return 0;
00052 }
00053
00054 QTextCodec * QUtf7CodecPlugin::createForName( const QString & name ) {
00055 if ( name == "UTF-7" )
00056 return new QUtf7Codec();
00057 else if ( name == "X-QT-UTF-7-STRICT" )
00058 return new QStrictUtf7Codec();
00059 return 0;
00060 }
00061
00062 KDE_Q_EXPORT_PLUGIN( QUtf7CodecPlugin );
|