libkdenetwork Library API Documentation

qutf7codecplugin.cpp

00001 /*
00002   qutf7codecplugin.cpp
00003 
00004   A QTextCodec for UTF-7 (rfc2152).
00005   Copyright (c) 2001 Marc Mutz <mutz@kde.org>
00006   See file COPYING for details
00007 
00008   This program is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License, version 2.0,
00010   as published by the Free Software Foundation.
00011 
00012   You should have received a copy of the GNU General Public License
00013   along with this program; if not, write to the Free Software
00014   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00015   02111-1307, US
00016 
00017   As a special exception, permission is granted to use this plugin
00018   with any version of Qt by TrollTech AS, Norway. In this case, the
00019   use of this plugin doesn't cause the resulting executable to be
00020   covered by the GNU General Public License.
00021   This exception does not however invalidate any other reasons why the
00022   executable file might be covered by the GNU General Public License.
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 class QUtf7CodecPlugin : public QTextCodecPlugin {
00035 public:
00036   QUtf7TextCodecPlugin() {}
00037 
00038   QStringList names() const { return QStringList() << "UTF-7" << "X-QT-UTF-7-STRICT"; }
00039   QValueList<int> mibEnums() const { return QValueList<int>() << 1012 << -1012; }
00040   QTextCodec * createForMib( int );
00041   QTextCodec * createForName( const QString & );
00042 };
00043 
00044 QTextCodec * QUtf7CodecPlugin::createForMib( int mib ) {
00045   if ( mib == 1012 )
00046     return new QUtf7Codec();
00047   else if ( mib == -1012 )
00048     return new QStrictUtf7Codec();
00049   return 0;
00050 }
00051 
00052 QTextCodec * QUtf7CodecPlugin::createForName( const QString & name ) {
00053   if ( name == "UTF-7" )
00054     return new QUtf7Codec();
00055   else if ( name == "X-QT-UTF-7-STRICT" )
00056     return new QStrictUtf7Codec();
00057   return 0;
00058 }
00059 
00060 Q_EXPORT_PLUGIN( QUtf7CodecPlugin );
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 17 09:52:22 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003