KDECore
ksycocafactory.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KSYCOCAFACTORY_H
00020 #define KSYCOCAFACTORY_H
00021
00022 #include <ksycocaentry.h>
00023
00024 class KSycoca;
00025 class QString;
00026 class KSycocaDict;
00027 class KSycocaResourceList;
00028 template <typename T> class QList;
00029 template <typename KT, typename VT> class QHash;
00030
00031 typedef QHash<QString, KSycocaEntry::Ptr> KSycocaEntryDict;
00032
00037 class KDECORE_EXPORT KSycocaFactory
00038 {
00039 public:
00040 virtual KSycocaFactoryId factoryId() const = 0;
00041
00042 protected:
00047 explicit KSycocaFactory( KSycocaFactoryId factory_id );
00048
00049 public:
00050 virtual ~KSycocaFactory();
00051
00055 int offset() const;
00056
00060 KSycocaEntryDict * entryDict() { return m_entryDict; }
00061
00066 virtual KSycocaEntry *createEntry(const QString &file, const char *resource) const = 0;
00067
00071 virtual void addEntry(const KSycocaEntry::Ptr& newEntry);
00072
00077 void removeEntry(const QString& entryName);
00078
00082 virtual KSycocaEntry *createEntry(int offset) const = 0;
00083
00087 virtual KSycocaEntry::List allEntries() const;
00088
00100 virtual void save(QDataStream &str);
00101
00109 virtual void saveHeader(QDataStream &str);
00110
00115 const KSycocaResourceList * resourceList() const;
00116
00120 const KSycocaDict *sycocaDict() const;
00121
00125 bool isEmpty() const;
00126
00127 protected:
00128 QDataStream *m_str;
00129
00130 KSycocaResourceList *m_resourceList;
00131 KSycocaEntryDict *m_entryDict;
00132
00133 private:
00134 class Private;
00135 Private* const d;
00136
00137 protected:
00141 virtual void virtual_hook( int id, void* data );
00142 };
00143
00147 class KDECORE_EXPORT KSycocaFactoryList : public QList<KSycocaFactory*>
00148 {
00149 public:
00150 KSycocaFactoryList() { }
00151 };
00152
00153 #endif