KDECore
kprotocolinfofactory.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Torben Weis <weis@kde.org> 00003 Copyright (C) 2000,2003 Waldo Bastian <bastian@kde.org> 00004 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef __kprotocolinfofactory_h__ 00021 #define __kprotocolinfofactory_h__ 00022 00023 #include "../kio/kio/kprotocolinfo.h" 00024 00025 #include <qmap.h> 00026 #include <qstring.h> 00027 #include <qstringlist.h> 00028 #include <kurl.h> 00029 #include <ksycocafactory.h> 00030 00031 class KProtocolInfoPrivate; 00032 00040 class KDECORE_EXPORT KProtocolInfoFactory : public KSycocaFactory 00041 { 00042 K_SYCOCAFACTORY( KST_KProtocolInfoFactory ) 00043 public: 00048 static KProtocolInfoFactory* self() 00049 { if ( !_self) new KProtocolInfoFactory(); return _self; } 00051 KProtocolInfoFactory(); 00052 virtual ~KProtocolInfoFactory(); 00053 00054 /* 00055 * Returns protocol info for @p protocol. 00056 * 00057 * Does not take proxy settings into account. 00058 * @param protocol the protocol to search for 00059 * @return the pointer to the KProtocolInfo, or 0 if not found 00060 */ 00061 KProtocolInfo *findProtocol(const QString &protocol); 00062 00067 QStringList protocols(); 00068 protected: 00069 00073 virtual KSycocaEntry *createEntry(const QString &, const char *) 00074 { return 0; } 00075 00079 virtual KProtocolInfo *createEntry(int offset); 00080 00081 protected: 00082 static KProtocolInfoFactory *_self; 00083 00084 QMap<QString,KProtocolInfo::Ptr> m_cache; 00085 protected: 00086 virtual void virtual_hook( int id, void* data ); 00087 private: 00088 class KProtocolInfoFactoryPrivate* d; 00089 }; 00090 00091 #endif