kconfigbackend.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _KCONFIGBACKEND_H
00023 #define _KCONFIGBACKEND_H
00024
00025 #include "kconfigdata.h"
00026 #include <kconfigbase.h>
00027 #include "kdemacros.h"
00028
00029 class QFile;
00030 class KConfigBackEndPrivate;
00031
00047 class KConfigBackEnd
00048 {
00049 friend class KConfig;
00050 public:
00066 KConfigBackEnd(KConfigBase *_config, const QString &_fileName,
00067 const char * _resType, bool _useKDEGlobals);
00068
00072 virtual ~KConfigBackEnd();
00073
00080 virtual bool parseConfigFiles() = 0;
00081
00091 virtual void sync(bool bMerge = true) = 0;
00092
00103 void changeFileName(const QString &_fileName, const char * _resType,
00104 bool _useKDEGlobals);
00105
00111 virtual KConfigBase::ConfigState getConfigState() const
00112 { return mConfigState; }
00113
00118 QString fileName() const { return mfileName; }
00119
00124 const char * resource() const { return resType; }
00125
00131 void setLocaleString(const QCString &_localeString) { localeString = _localeString; }
00132
00137 void setFileWriteMode(int mode);
00138
00145 bool checkConfigFilesWritable(bool warnUser);
00146
00147 #ifdef KDE_NO_COMPAT
00148 private:
00149 #endif
00150
00153 KDE_DEPRECATED QString filename() const { return mfileName; }
00154
00155
00156 protected:
00157 KConfigBase *pConfig;
00158
00159 QString mfileName;
00160 QCString resType;
00161 bool useKDEGlobals : 1;
00162 bool bFileImmutable : 1;
00163 QCString localeString;
00164 QString mLocalFileName;
00165 QString mGlobalFileName;
00166 KConfigBase::ConfigState mConfigState;
00167 int mFileMode;
00168
00169 protected:
00170 virtual void virtual_hook( int id, void* data );
00171 protected:
00172 class KConfigBackEndPrivate;
00173 KConfigBackEndPrivate *d;
00174 };
00175
00176 class KConfigINIBackEndPrivate;
00177
00185 class KConfigINIBackEnd : public KConfigBackEnd
00186 {
00187
00188 public:
00204 KConfigINIBackEnd(KConfigBase *_config, const QString &_fileName,
00205 const char * _resType, bool _useKDEGlobals = true)
00206 : KConfigBackEnd(_config, _fileName, _resType, _useKDEGlobals) {}
00207
00211 virtual ~KConfigINIBackEnd() {};
00212
00218 bool parseConfigFiles();
00219
00227 virtual void sync(bool bMerge = true);
00228
00229 protected:
00245 void parseSingleConfigFile(QFile& rFile, KEntryMap *pWriteBackMap = 0L,
00246 bool bGlobal = false, bool bDefault = false);
00247
00262 bool writeConfigFile(QString filename, bool bGlobal = false, bool bMerge = true);
00263
00276 bool getEntryMap(KEntryMap &map, bool bGlobal, QFile *mergeFile);
00277
00279 void writeEntries(FILE *pStream, const KEntryMap &aTempMap);
00280
00281 protected:
00282 virtual void virtual_hook( int id, void* data );
00283 private:
00284 KConfigINIBackEndPrivate *not_d;
00285 };
00286
00287 #endif
This file is part of the documentation for kdecore Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 4 22:43:29 2004 by
doxygen 1.3.6-20040222 written by
Dimitri van Heesch, © 1997-2003