#include </home/clem/local/src/opie/libopie2/opiecore/oconfig.h>
Collaboration diagram for Opie::Core::OConfigGroupSaver:

Public Member Functions | |
| OConfigGroupSaver (OConfig *config, QString group) | |
| OConfigGroupSaver (OConfig *config, const char *group) | |
| OConfigGroupSaver (OConfig *config, const QCString &group) | |
| ~OConfigGroupSaver () | |
| OConfig * | config () |
Private Member Functions | |
| OConfigGroupSaver (const OConfigGroupSaver &) | |
| OConfigGroupSaver & | operator= (const OConfigGroupSaver &) |
Private Attributes | |
| OConfig * | _config |
| QString | _oldgroup |
| Private * | d |
Careful programmers always set the group of a OConfig 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 OConfigGroupSaver. 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 OConfigGroupSaver: Simply enclose all work with one group (including the creation of the OConfigGroupSaver object) in one block.
OConfigGroupSaver saver(cfg,"TheGroupThatInWhat");
Note that OConfigGroupSaver (cfg,"TheGroupThatInWhat"); would get imediately destructed after created and that you would save in the old group which is unwished.
Definition at line 125 of file oconfig.h.
|
||||||||||||
|
Constructor. Create the object giving a OConfig object and a group to become the current group. Definition at line 133 of file oconfig.h. References _config, and Config::setGroup(). |
|
||||||||||||
|
Definition at line 136 of file oconfig.h. References _config, and Config::setGroup(). |
|
||||||||||||
|
Definition at line 139 of file oconfig.h. References _config, and Config::setGroup(). |
|
|
Destructor. Restores the last current group.
Definition at line 146 of file oconfig.h. References _config, _oldgroup, and Config::setGroup(). |
|
|
|
|
|
Definition at line 148 of file oconfig.h. References _config. Referenced by CameraMainWindow::init(), main(), Opie::Core::OGlobalSettings::showContextMenusOnPress(), and CameraMainWindow::~CameraMainWindow(). |
|
|
|
|
|
Definition at line 148 of file oconfig.h. Referenced by config(), OConfigGroupSaver(), and ~OConfigGroupSaver(). |
|
|
Definition at line 152 of file oconfig.h. Referenced by ~OConfigGroupSaver(). |
|
|
|
1.4.2