| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 "kdelibs_export.h"
    00029
    00030 class QFile;
    00031 class KConfigBackEndPrivate;
    00032
    00047 class KDECORE_EXPORT KConfigBackEnd
    00048 {
    00049   friend class KConfig;
    00050   friend class KSharedConfig;
    00051 public:
    00067   KConfigBackEnd(KConfigBase *_config, const QString &_fileName,
    00068          const char * _resType, bool _useKDEGlobals);
    00069
    00073   virtual ~KConfigBackEnd();
    00074
    00081   virtual bool parseConfigFiles() = 0;
    00082
    00092   virtual void sync(bool bMerge = true) = 0;
    00093
    00104   void changeFileName(const QString &_fileName, const char * _resType,
    00105               bool _useKDEGlobals);
    00106
    00112   virtual KConfigBase::ConfigState getConfigState() const
    00113     { return mConfigState; }
    00114
    00119   QString fileName() const { return mfileName; }
    00120
    00125   const char * resource() const { return resType; }
    00126
    00132   void setLocaleString(const QCString &_localeString) { localeString = _localeString; }
    00133
    00138   void setFileWriteMode(int mode);
    00139
    00146   bool checkConfigFilesWritable(bool warnUser);
    00147
    00153   KLockFile::Ptr lockFile( bool bGlobal = false );
    00154
    00155 #ifdef KDE_NO_COMPAT
    00156 private:
    00157 #endif
    00158
    00161   KDE_DEPRECATED QString filename() const { return mfileName; }
    00162
    00163 protected:
    00164   KConfigBase *pConfig;
    00165
    00166   QString mfileName;
    00167   QCString resType;
    00168   bool useKDEGlobals : 1;
    00169   bool bFileImmutable : 1;
    00170   QCString localeString;
    00171   QString mLocalFileName;
    00172   QString mGlobalFileName;
    00173   KConfigBase::ConfigState mConfigState;
    00174   int mFileMode;
    00175
    00176 protected:
    00177   virtual void virtual_hook( int id, void* data );
    00178 protected:
    00179   class KConfigBackEndPrivate;
    00180   KConfigBackEndPrivate *d;
    00181 };
    00182
    00183
    00190 class KDECORE_EXPORT KConfigINIBackEnd : public KConfigBackEnd
    00191 {
    00192
    00193 public:
    00209   KConfigINIBackEnd(KConfigBase *_config, const QString &_fileName,
    00210             const char * _resType, bool _useKDEGlobals = true)
    00211     : KConfigBackEnd(_config, _fileName, _resType, _useKDEGlobals) {}
    00212
    00216   virtual ~KConfigINIBackEnd() {};
    00217
    00223   bool parseConfigFiles();
    00224
    00232   virtual void sync(bool bMerge = true);
    00233
    00234 protected:
    00250   void parseSingleConfigFile(QFile& rFile, KEntryMap *pWriteBackMap = 0L,
    00251                  bool bGlobal = false, bool bDefault = false);
    00252
    00267   bool writeConfigFile(QString filename, bool bGlobal = false, bool bMerge = true);
    00268
    00281   bool getEntryMap(KEntryMap &map, bool bGlobal, QFile *mergeFile);
    00282
    00284   void writeEntries(FILE *pStream, const KEntryMap &aTempMap);
    00285
    00286 protected:
    00287   virtual void virtual_hook( int id, void* data );
    00288 private:
    00289   class KConfigINIBackEndPrivate;
    00290   KConfigINIBackEndPrivate *not_d;
    00291 };
    00292
    00293 #endif

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003