KConfigGroupSaver Class Reference

[kdecore Index] [kdecore Hierarchy] [Headers]


helper class for easier use of KConfig/KSimpleConfig groups More...

#include <kconfigbase.h>

Public Members


Detailed Description

Helper class to facilitate working with 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.

See Also: KConfigBase


KConfigGroupSaver( KConfigBase* config, QString group ) [public]

Constructor. You pass a pointer to the KConfig/KSimpleConfigobject you want to work with and a string indicating the _new_ group.

Parameters:
group the new group that the KConfig/KSimpleConfig object should switch to
config the KConfig/KSimpleConfig object this KConfigGroupSaver works on

  • Author: Kalle Dalheimer <kalle@kde.org>
  • Version: $Id: KConfigGroupSaver.html.in,v 1.1.1.1 2000/02/09 22:24:52 tasin Exp $
  • Documentation generated by tasin@cd1 on Die Nov 30 17:31:35 CET 1999
Kdoc