KDECore
ksycocafactory.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 * Copyright (C) 1999 Waldo Bastian <bastian@kde.org> 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License version 2 as published by the Free Software Foundation; 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Library General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Library General Public License 00014 * along with this library; see the file COPYING.LIB. If not, write to 00015 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 * Boston, MA 02110-1301, USA. 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: // virtual class 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*> //krazy:exclude=dpointer (acts as a typedef) 00148 { 00149 public: 00150 KSycocaFactoryList() { } 00151 }; 00152 00153 #endif