1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1999 Torben Weis <weis@kde.org> |
3 | Copyright (C) 2000,2003 Waldo Bastian <bastian@kde.org> |
4 | |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | #ifndef kprotocolinfofactory_h |
21 | #define kprotocolinfofactory_h |
22 | |
23 | #include "kprotocolinfo.h" |
24 | |
25 | #include <QtCore/QMap> |
26 | #include <QtCore/QString> |
27 | #include <QtCore/QStringList> |
28 | #include <kurl.h> |
29 | #include <ksycocafactory.h> |
30 | |
31 | |
32 | /** |
33 | * @internal |
34 | * |
35 | * KProtocolInfoFactory is a factory for getting |
36 | * KProtocolInfo. The factory is a singleton |
37 | * (only one instance can exist). |
38 | * |
39 | * @short Factory for KProtocolInfo |
40 | * |
41 | * Exported for kbuildsycoca, but not installed. |
42 | */ |
43 | class KDECORE_EXPORT KProtocolInfoFactory : public KSycocaFactory |
44 | { |
45 | K_SYCOCAFACTORY( KST_KProtocolInfoFactory ) |
46 | public: |
47 | /** |
48 | * The instance of the KProtocolInfoFactory. |
49 | * @return the factory instance |
50 | */ |
51 | static KProtocolInfoFactory* self(); |
52 | |
53 | /** \internal */ |
54 | KProtocolInfoFactory(); |
55 | virtual ~KProtocolInfoFactory(); |
56 | |
57 | /* |
58 | * Returns protocol info for @p protocol. |
59 | * |
60 | * Does not take proxy settings into account. |
61 | * @param protocol the protocol to search for |
62 | * @return the pointer to the KProtocolInfo, or 0 if not found |
63 | */ |
64 | KProtocolInfo::Ptr findProtocol(const QString &protocol); |
65 | |
66 | /** |
67 | * @return all protocols |
68 | */ |
69 | KProtocolInfo::List allProtocols() const; |
70 | |
71 | /** |
72 | * Returns list of all known protocols. |
73 | * @return a list of all protocols |
74 | */ |
75 | QStringList protocols() const; |
76 | |
77 | protected: |
78 | /** |
79 | * @internal Not used. |
80 | */ |
81 | virtual KSycocaEntry *createEntry(const QString &, const char *) const |
82 | { return 0; } |
83 | |
84 | /** |
85 | * @internal |
86 | */ |
87 | virtual KProtocolInfo *createEntry(int offset) const; |
88 | |
89 | protected: |
90 | /** Virtual hook, used to add new "virtual" functions while maintaining |
91 | binary compatibility. Unused in this class. |
92 | */ |
93 | virtual void virtual_hook( int id, void* data ); |
94 | private: |
95 | QMap<QString,KProtocolInfo::Ptr> m_cache; |
96 | class KProtocolInfoFactoryPrivate* d; |
97 | }; |
98 | |
99 | #endif |
100 | |