KDECore
ksycoca_p.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 * Copyright (C) 1999-2000 Waldo Bastian <bastian@kde.org> 00003 * Copyright (C) 2005-2009 David Faure <faure@kde.org> 00004 * Copyright (C) 2008 Hamish Rodda <rodda@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License version 2 as published by the Free Software Foundation; 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 **/ 00020 00021 #ifndef KSYCOCA_P_H 00022 #define KSYCOCA_P_H 00023 00024 #include "ksycocafactory.h" 00025 #include <QStringList> 00026 class QFile; 00027 class QDataStream; 00028 class KSycocaAbstractDevice; 00029 00030 class KSycocaPrivate 00031 { 00032 public: 00033 KSycocaPrivate(); 00034 bool checkVersion(); 00035 bool openDatabase(bool openDummyIfNotFound=true); 00036 enum BehaviorIfNotFound { 00037 IfNotFoundDoNothing = 0, 00038 IfNotFoundOpenDummy = 1, 00039 IfNotFoundRecreate = 2 00040 }; 00041 Q_DECLARE_FLAGS(BehaviorsIfNotFound, BehaviorIfNotFound) 00042 bool checkDatabase(BehaviorsIfNotFound ifNotFound); 00043 void closeDatabase(); 00044 void setStrategyFromString(const QString& strategy); 00045 bool tryMmap(); 00046 00047 KSycocaAbstractDevice* device(); 00048 QDataStream*& stream(); 00049 00050 enum { 00051 DatabaseNotOpen, // openDatabase must be called 00052 NoDatabase, // not found, so we opened a dummy one instead 00053 BadVersion, // it's opened, but it's not useable 00054 DatabaseOK } databaseStatus; 00055 bool readError; 00056 00057 quint32 timeStamp; 00058 enum { StrategyMmap, StrategyMemFile, StrategyFile, StrategyDummyBuffer } m_sycocaStrategy; 00059 QString m_databasePath; 00060 QStringList changeList; 00061 QString language; 00062 quint32 updateSig; 00063 QStringList allResourceDirs; 00064 00065 void addFactory(KSycocaFactory* factory) { 00066 m_factories.append(factory); 00067 } 00068 KSycocaFactoryList* factories() { return &m_factories; } 00069 00070 private: 00071 KSycocaFactoryList m_factories; 00072 size_t sycoca_size; 00073 const char *sycoca_mmap; 00074 QFile* m_mmapFile; 00075 KSycocaAbstractDevice* m_device; 00076 }; 00077 00078 #endif /* KSYCOCA_P_H */ 00079
KDE 4.6 API Reference