kdecore Library API Documentation

KConfigINIBackEnd Class Reference

Class for KDE INI-style configuration file loading/saving. More...

#include <kconfigbackend.h>

Inheritance diagram for KConfigINIBackEnd:

KConfigBackEnd List of all members.

Public Methods

 KConfigINIBackEnd (KConfigBase *_config, const QString &_fileName, const char *_resType, bool _useKDEGlobals=true)
 Constructs an ini-style configuration back end.

virtual ~KConfigINIBackEnd ()
 Destructs the configuration backend.

bool parseConfigFiles ()
 Parses all INI-style configuration files for a config object.

virtual void sync (bool bMerge=true)
 Writes configuration data to file(s).


Protected Methods

void parseSingleConfigFile (QFile &rFile, KEntryMap *pWriteBackMap=0L, bool bGlobal=false, bool bDefault=false)
 Parses one configuration file.

bool writeConfigFile (QString filename, bool bGlobal=false, bool bMerge=true)
 Writes configuration file back.

virtual void virtual_hook (int id, void *data)

Detailed Description

Class for KDE INI-style configuration file loading/saving.

Author:
Preston Brown <pbrown@kde.org>, Matthias Kalle Dalheimer <kalle@kde.org>
Version:
Id:
kconfigbackend.h,v 1.22 2002/09/17 21:24:43 tjansen Exp

Definition at line 174 of file kconfigbackend.h.


Constructor & Destructor Documentation

KConfigINIBackEnd::KConfigINIBackEnd KConfigBase   _config,
const QString   _fileName,
const char *    _resType,
bool    _useKDEGlobals = true
[inline]
 

Constructs an ini-style configuration back end.

Parameters:
_config  Specifies the configuration object which values will be passed to as they are read, or from where values to be written to will be obtained from.
_fileName  The name of the file in which config data is stored. All registered configuration directories will be looked in in order of decreasing relevance.
_resType  the resource type of the fileName specified, _if_ it is not an absolute path (otherwise this parameter is ignored).
_useKDEGlobals  If true, the user's system-wide kdeglobals file will be imported into the config object. If false, only the filename specified will be dealt with.

Definition at line 193 of file kconfigbackend.h.

virtual KConfigINIBackEnd::~KConfigINIBackEnd   [inline, virtual]
 

Destructs the configuration backend.

Definition at line 200 of file kconfigbackend.h.


Member Function Documentation

bool KConfigINIBackEnd::parseConfigFiles   [virtual]
 

Parses all INI-style configuration files for a config object.

Returns:
Whether or not parsing was successful.

Implements KConfigBackEnd.

Definition at line 198 of file kconfigbackend.cpp.

References QFile::close(), KURL::directory(), KGlobal::dirs(), QString::fromLatin1(), QCString::isEmpty(), QString::isEmpty(), KConfigBase::isReadOnly(), KStandardDirs::isRestrictedResource(), KStandardDirs::makeDir(), QFile::open(), parseSingleConfigFile(), KConfigBackEnd::setLocaleString(), KURL::setPath(), and QString::utf8().

void KConfigINIBackEnd::sync bool    bMerge = true [virtual]
 

Writes configuration data to file(s).

Parameters:
bMerge  Specifies whether the old config file already on disk should be merged in with the data in memory. If true, data is read off the disk and merged. If false, the on-disk file is removed and only in-memory data is written out.

Implements KConfigBackEnd.

Definition at line 575 of file kconfigbackend.cpp.

References KURL::directory(), KConfigBase::isDirty(), QString::isEmpty(), KStandardDirs::makeDir(), KURL::setPath(), and writeConfigFile().

void KConfigINIBackEnd::parseSingleConfigFile QFile   rFile,
KEntryMap *    pWriteBackMap = 0L,
bool    bGlobal = false,
bool    bDefault = false
[protected]
 

Parses one configuration file.

Parameters:
rFile  The configuration file to parse
pWriteBackMap  If specified, points to a KEntryMap where the data read from the file should be stored, instead of inserting them directly into the configuration object. Use this area as a "scratchpad" when you need to know what is on disk but don't want to effect the configuration object.
bGlobal  Specifies whether entries should be marked as belonging to the global KDE configuration file rather than the application-specific KDE configuration file(s).
bDefault  Specifies whether entries should be marked as being default values.

Definition at line 313 of file kconfigbackend.cpp.

References KEntryKey::bDefault, KEntry::bDeleted, KEntry::bExpand, KEntry::bGlobal, KEntry::bImmutable, KEntryKey::bLocal, KEntry::bNLS, QFile::handle(), QMap< KEntryKey, KEntry >::insert(), KStdAccel::key(), QCString::length(), KConfigBase::lookupData(), KEntry::mValue, QFile::name(), KConfigBase::putData(), QFile::readAll(), and QFile::size().

Referenced by parseConfigFiles(), and writeConfigFile().

bool KConfigINIBackEnd::writeConfigFile QString    filename,
bool    bGlobal = false,
bool    bMerge = true
[protected]
 

Writes configuration file back.

Parameters:
filename  The name of the file to write.
bGlobal  Specifies whether to write only entries which are marked as belonging to the global KDE config file. If this is false, it skips those entries.
bMerge  Specifies whether the old config file already on disk should be merged in with the data in memory. If true, data is read off the disk and merged. If false, the on-disk file is removed and only in-memory data is written out.
Returns:
Whether some entries are left to be written to other files.

Definition at line 709 of file kconfigbackend.cpp.

References KEntry::bDirty, QMap< KEntryKey, KEntry >::begin(), KEntry::bGlobal, KSaveFile::close(), QFile::close(), QFile::encodeName(), QMap< KEntryKey, KEntry >::end(), KSaveFile::fstream(), KSaveFile::handle(), KConfigBase::internalEntryMap(), KConfigBase::isReadOnly(), QFile::open(), parseSingleConfigFile(), QMap< KEntryKey, KEntry >::replace(), and KSaveFile::status().

Referenced by sync().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:20:44 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001