kdecore Library API Documentation

KConfigGroupSaver Class Reference

Helper class to facilitate working with KConfig / KSimpleConfig groups. Helper class for easier use of KConfig/KSimpleConfig groups. More...

#include <kconfigbase.h>

List of all members.

Public Methods

 KConfigGroupSaver (KConfigBase *config, QString group)
 Constructor.


Detailed Description

Helper class to facilitate working with KConfig / KSimpleConfig groups. Helper class for easier use of KConfig/KSimpleConfig groups.

Careful programmers always set the group of a KConfig KSimpleConfig object to the group they want to read from and set it back to the old one of afterwards. This is usually written as:


 QString oldgroup config->group();
 config->setGroup( "TheGroupThatIWant" );
 ...
 config->writeEntry( "Blah", "Blubb" );

 config->setGroup( oldgroup );
 

In order to facilitate this task, you can use KConfigGroupSaver. Simply construct such an object ON THE STACK when you want to switch to a new group. Then, when the object goes out of scope, the group will automatically be restored. If you want to use several different groups within a function or method, you can still use KConfigGroupSaver: Simply enclose all work with one group (including the creation of the KConfigGroupSaver object) in one block.

Author:
Matthias Kalle Dalheimer <kalle@kde.org>
Version:
Id:
kconfigbase.h,v 1.83 2002/09/08 14:55:41 tjansen Exp
See also:
KConfigBase, KConfig, KSimpleConfig

Definition at line 1762 of file kconfigbase.h.


Constructor & Destructor Documentation

KConfigGroupSaver::KConfigGroupSaver KConfigBase   config,
QString    group
[inline]
 

Constructor.

You pass a pointer to the KConfigBase-derived object you want to work with and a string indicating the _new_ group.

Parameters:
config  The KConfigBase-derived object this KConfigGroupSaver works on.
group  The new group that the config object should switch to.

Definition at line 1773 of file kconfigbase.h.

References KConfigBase::setGroup().


The documentation for this class was generated from the following file:
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