kdecore Library API Documentation

kconfigbackend.h

00001 /* 00002 This file is part of the KDE libraries 00003 Copyright (c) 1999 Preston Brown <pbrown@kde.org> 00004 Portions copyright (c) 1997 Matthias Kalle Dalheimer <kalle@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 as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef _KCONFIGBACKEND_H 00023 #define _KCONFIGBACKEND_H 00024 00025 #include "kconfigdata.h" 00026 #include <kconfigbase.h> 00027 #include <klockfile.h> 00028 #include "kdemacros.h" 00029 00030 class QFile; 00031 class KConfigBackEndPrivate; 00032 00048 class KConfigBackEnd 00049 { 00050 friend class KConfig; 00051 friend class KSharedConfig; 00052 public: 00068 KConfigBackEnd(KConfigBase *_config, const QString &_fileName, 00069 const char * _resType, bool _useKDEGlobals); 00070 00074 virtual ~KConfigBackEnd(); 00075 00082 virtual bool parseConfigFiles() = 0; 00083 00093 virtual void sync(bool bMerge = true) = 0; 00094 00105 void changeFileName(const QString &_fileName, const char * _resType, 00106 bool _useKDEGlobals); 00107 00113 virtual KConfigBase::ConfigState getConfigState() const 00114 { return mConfigState; } 00115 00120 QString fileName() const { return mfileName; } 00121 00126 const char * resource() const { return resType; } 00127 00133 void setLocaleString(const QCString &_localeString) { localeString = _localeString; } 00134 00139 void setFileWriteMode(int mode); 00140 00147 bool checkConfigFilesWritable(bool warnUser); 00148 00149 #ifdef KDE_NO_COMPAT 00150 private: 00151 #endif 00152 00155 KDE_DEPRECATED QString filename() const { return mfileName; } 00156 00162 KLockFile::Ptr lockFile( bool bGlobal = false ); 00163 00164 protected: 00165 KConfigBase *pConfig; 00166 00167 QString mfileName; 00168 QCString resType; 00169 bool useKDEGlobals : 1; 00170 bool bFileImmutable : 1; 00171 QCString localeString; 00172 QString mLocalFileName; 00173 QString mGlobalFileName; 00174 KConfigBase::ConfigState mConfigState; 00175 int mFileMode; 00176 00177 protected: 00178 virtual void virtual_hook( int id, void* data ); 00179 protected: 00180 class KConfigBackEndPrivate; 00181 KConfigBackEndPrivate *d; 00182 }; 00183 00184 00192 class KConfigINIBackEnd : public KConfigBackEnd 00193 { 00194 00195 public: 00211 KConfigINIBackEnd(KConfigBase *_config, const QString &_fileName, 00212 const char * _resType, bool _useKDEGlobals = true) 00213 : KConfigBackEnd(_config, _fileName, _resType, _useKDEGlobals) {} 00214 00218 virtual ~KConfigINIBackEnd() {}; 00219 00225 bool parseConfigFiles(); 00226 00234 virtual void sync(bool bMerge = true); 00235 00236 protected: 00252 void parseSingleConfigFile(QFile& rFile, KEntryMap *pWriteBackMap = 0L, 00253 bool bGlobal = false, bool bDefault = false); 00254 00269 bool writeConfigFile(QString filename, bool bGlobal = false, bool bMerge = true); 00270 00283 bool getEntryMap(KEntryMap &map, bool bGlobal, QFile *mergeFile); 00284 00286 void writeEntries(FILE *pStream, const KEntryMap &aTempMap); 00287 00288 protected: 00289 virtual void virtual_hook( int id, void* data ); 00290 private: 00291 class KConfigINIBackEndPrivate; 00292 KConfigINIBackEndPrivate *not_d; 00293 }; 00294 00295 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:26:06 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003