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 "ksycocatype.h" 00023 #include "ksycocaentry.h" 00024 00025 #include <qdict.h> 00026 #include <qptrlist.h> 00027 class KSycoca; 00028 class QStringList; 00029 class QString; 00030 class KSycocaDict; 00031 class KSycocaResourceList; 00032 00033 typedef QDict<KSycocaEntry::Ptr> KSycocaEntryDict; 00034 00039 class KDECORE_EXPORT KSycocaFactory 00040 { 00041 public: 00042 virtual KSycocaFactoryId factoryId() const = 0; 00043 00044 protected: // virtual class 00049 KSycocaFactory( KSycocaFactoryId factory_id ); 00050 00051 public: 00052 virtual ~KSycocaFactory(); 00053 00057 int offset() { return mOffset; } 00058 00062 KSycocaEntryDict * entryDict() { return m_entryDict; } 00063 00068 virtual KSycocaEntry *createEntry(const QString &file, const char *resource) = 0; 00069 00073 virtual void addEntry(KSycocaEntry *newEntry, const char *resource); 00074 00079 void removeEntry(KSycocaEntry *newEntry); 00080 00084 virtual KSycocaEntry *createEntry(int offset)=0; 00085 00089 KSycocaEntry::List allEntries(); 00090 00102 virtual void save(QDataStream &str); 00103 00111 virtual void saveHeader(QDataStream &str); 00112 00116 virtual const KSycocaResourceList * resourceList() const { return m_resourceList; } 00117 00118 private: 00119 int mOffset; 00120 00121 protected: 00122 int m_sycocaDictOffset; 00123 int m_beginEntryOffset; 00124 int m_endEntryOffset; 00125 QDataStream *m_str; 00126 00127 KSycocaResourceList *m_resourceList; 00128 KSycocaEntryDict *m_entryDict; 00129 KSycocaDict *m_sycocaDict; 00130 protected: 00131 virtual void virtual_hook( int id, void* data ); 00132 }; 00133 00137 class KDECORE_EXPORT KSycocaFactoryList : public QPtrList<KSycocaFactory> 00138 { 00139 public: 00140 KSycocaFactoryList() { } 00141 }; 00142 00143 #endif