tdesycoca.h
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 __tdesycoca_h__ 00020 #define __tdesycoca_h__ 00021 00022 #include <dcopobject.h> 00023 #include <tqobject.h> 00024 #include <tqstringlist.h> 00025 #include "tdesycocatype.h" 00026 #include <tdelibs_export.h> 00027 00028 class TQDataStream; 00029 class KSycocaPrivate; 00030 class KSycocaFactory; 00031 class KSycocaFactoryList; 00032 00033 /* 00034 * Sycoca file version number. 00035 * If the existing file is outdated, it will not get read 00036 * but instead we'll ask kded to regenerate a new one... 00037 */ 00038 #define TDESYCOCA_VERSION 94 00039 00044 class TDECORE_EXPORT KSycoca : public TQObject, public DCOPObject 00045 { 00046 Q_OBJECT 00047 K_DCOP 00048 00049 protected: 00054 KSycoca( bool /* buildDatabase */ ); 00055 00056 public: 00057 00061 KSycoca(); 00062 00066 static KSycoca *self(); 00067 00068 virtual ~KSycoca(); 00069 00070 static int version(); 00071 00076 TQDataStream *findEntry(int offset, KSycocaType &type); 00080 TQDataStream *findFactory( KSycocaFactoryId id); 00084 TQString kfsstnd_prefixes(); 00088 TQString language(); 00089 00096 TQ_UINT32 timeStamp(); 00097 00107 TQ_UINT32 updateSignature(); 00108 00113 TQStringList allResourceDirs(); 00114 00118 void addFactory( KSycocaFactory * ); 00119 00124 virtual bool isBuilding() { return false; } 00125 00129 void disableAutoRebuild(); 00130 00134 static TQString determineRelativePath( const TQString & _fullpath, const char *_resource ); 00135 00141 static bool isChanged(const char *type); 00142 00146 static void flagError(); 00147 00151 static bool readError(); 00152 00153 k_dcop: 00157 void notifyDatabaseChanged(const TQStringList &); 00158 00159 signals: 00164 void databaseChanged(); 00165 00166 protected: 00167 bool checkVersion(bool abortOnError=true); 00168 bool openDatabase(bool openDummyIfNotFound=true); 00169 void closeDatabase(); 00170 KSycocaFactoryList *m_lstFactories; 00171 TQDataStream *m_str; 00172 TQByteArray *m_barray; 00173 bool bNoDatabase; 00174 size_t m_sycoca_size; 00175 const char *m_sycoca_mmap; 00176 TQ_UINT32 m_timeStamp; 00177 00178 public: 00179 static KSycoca *_self; // Internal use only. 00180 00181 protected: 00182 virtual void virtual_hook( int id, void* data ); 00183 private: 00184 KSycocaPrivate *d; 00185 }; 00186 00187 #endif