00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _KCONFIGBACKEND_H
00026 #define _KCONFIGBACKEND_H
00027
00028 #include "kconfigdata.h"
00029 #include "kconfigbase.h"
00030
00031 namespace config {
00032
00033 class KConfigBackEndPrivate;
00034
00050 class KConfigBackEnd
00051 {
00052 public:
00068 KConfigBackEnd(KConfigBase *_config, const string &_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 string &_fileName, const char * _resType,
00106 bool _useKDEGlobals);
00107
00113 virtual KConfigBase::ConfigState getConfigState() const
00114 { return mConfigState; }
00115
00119 string fileName() const { return mfileName; }
00120
00124 const char * resource() const { return resType.c_str(); }
00125
00126 void setLocaleString(const string &_localeString) { localeString = _localeString; }
00127
00131 void setFileWriteMode(int mode);
00132
00133 #ifdef KDE_NO_COMPAT
00134 private:
00135 #endif
00136
00139 string filename() const { return mfileName; }
00140
00141
00142 protected:
00143 KConfigBase *pConfig;
00144
00145 string mfileName;
00146 string resType;
00147 bool useKDEGlobals : 1;
00148 bool bFileImmutable : 1;
00149 string localeString;
00150 string mLocalFileName;
00151 string mGlobalFileName;
00152 KConfigBase::ConfigState mConfigState;
00153 int mFileMode;
00154
00155 protected:
00156 virtual void virtual_hook( int id, void* data );
00157 private:
00158 KConfigBackEndPrivate *d;
00159 };
00160
00161 class KConfigINIBackEndPrivate;
00162
00170 class KConfigINIBackEnd : public KConfigBackEnd
00171 {
00172
00173 public:
00189 KConfigINIBackEnd(KConfigBase *_config, const string &_fileName,
00190 const char * _resType, bool _useKDEGlobals = true)
00191 : KConfigBackEnd(_config, _fileName, _resType, _useKDEGlobals) {}
00192
00196 virtual ~KConfigINIBackEnd() {};
00197
00203 bool parseConfigFiles();
00204
00208 virtual void sync(bool bMerge = true);
00209
00210 protected:
00226 void parseSingleConfigFile(string& rFile, KEntryMap *pWriteBackMap = 0L,
00227 bool bGlobal = false, bool bDefault = false);
00228
00243 bool writeConfigFile(string filename, bool bGlobal = false, bool bMerge = true);
00244
00245 protected:
00246 virtual void virtual_hook( int id, void* data );
00247 private:
00248 KConfigINIBackEndPrivate *d;
00249 };
00250 };
00251
00252 #endif