KConfigBase

Search for usage in LXR

#include <KConfigBase>

Inheritance diagram for KConfigBase:

Public Types

enum  AccessMode { NoAccess , ReadOnly , ReadWrite }
 
enum  WriteConfigFlag {
  Persistent = 0x01 , Global = 0x02 , Localized = 0x04 , Notify = 0x08 | Persistent ,
  Normal = Persistent
}
 
typedef QFlags< WriteConfigFlagWriteConfigFlags
 

Public Member Functions

virtual ~KConfigBase ()
 
virtual AccessMode accessMode () const =0
 
void deleteGroup (const QString &group, WriteConfigFlags flags=Normal)
 
KConfigGroup group (const QString &group)
 
const KConfigGroup group (const QString &group) const
 
virtual QStringList groupList () const =0
 
bool hasGroup (const QString &group) const
 
bool isGroupImmutable (const QString &group) const
 
virtual bool isImmutable () const =0
 
virtual void markAsClean ()=0
 
virtual bool sync ()=0
 

Protected Member Functions

virtual void deleteGroupImpl (const QString &groupName, WriteConfigFlags flags=Normal)=0
 
virtual const KConfigGroup groupImpl (const QString &groupName) const =0
 
virtual KConfigGroup groupImpl (const QString &groupName)=0
 
virtual bool hasGroupImpl (const QString &groupName) const =0
 
virtual bool isGroupImmutableImpl (const QString &groupName) const =0
 
virtual void virtual_hook (int id, void *data)
 

Detailed Description

Interface to interact with configuration.

KConfigBase allows a component of an application to persists its configuration without the component knowing if it is storing the configuration into a top level KConfig or a KConfigGroup inside a KConfig instance.

Definition at line 30 of file kconfigbase.h.

Member Typedef Documentation

◆ WriteConfigFlags

Stores a combination of WriteConfigFlag values.

Definition at line 67 of file kconfigbase.h.

Member Enumeration Documentation

◆ AccessMode

Possible return values for accessMode().

Definition at line 127 of file kconfigbase.h.

◆ WriteConfigFlag

Flags to control write entry.

See also
WriteConfigFlags
Enumerator
Persistent 

Save this entry when saving the config object.

Global 

Save the entry to the global KDE config file instead of the application specific config file.

Localized 

Add the locale tag to the key when writing it.

Notify 

Notify remote KConfigWatchers of changes (requires DBus support) Implied persistent.

Since
5.51
Normal 

Save the entry to the application specific config file without a locale tag.

This is the default.

Definition at line 37 of file kconfigbase.h.

Constructor & Destructor Documentation

◆ ~KConfigBase()

KConfigBase::~KConfigBase ( )
virtual

Destructs the KConfigBase object.

Definition at line 41 of file kconfigbase.cpp.

◆ KConfigBase()

KConfigBase::KConfigBase ( )
protected

Definition at line 45 of file kconfigbase.cpp.

Member Function Documentation

◆ accessMode()

virtual AccessMode KConfigBase::accessMode ( ) const
pure virtual

Returns the access mode of the app-config object.

Possible return values are NoAccess (the application-specific config file could not be opened neither read-write nor read-only), ReadOnly (the application-specific config file is opened read-only, but not read-write) and ReadWrite (the application-specific config file is opened read-write).

Returns
the access mode of the app-config object

Implemented in KConfig, and KConfigGroup.

◆ deleteGroup()

void KConfigBase::deleteGroup ( const QString & group,
WriteConfigFlags flags = Normal )

Delete group.

This marks group as deleted in the config object. This effectively removes any cascaded values from config files earlier in the stack.

Definition at line 31 of file kconfigbase.cpp.

◆ deleteGroupImpl()

virtual void KConfigBase::deleteGroupImpl ( const QString & groupName,
WriteConfigFlags flags = Normal )
protectedpure virtual
Parameters
groupNamename of group

Implemented in KConfig, and KConfigGroup.

◆ group() [1/2]

KConfigGroup KConfigBase::group ( const QString & group)

Returns an object for the named subgroup.

Parameters
groupthe group to open. Pass an empty string here to the KConfig object to obtain a handle on the root group.
Returns
config group object for the given group name.

Definition at line 21 of file kconfigbase.cpp.

◆ group() [2/2]

const KConfigGroup KConfigBase::group ( const QString & group) const

Const overload for group(const QString&)

Definition at line 26 of file kconfigbase.cpp.

◆ groupImpl() [1/2]

virtual const KConfigGroup KConfigBase::groupImpl ( const QString & groupName) const
protectedpure virtual
Parameters
groupNamename of group

Implemented in KConfig, and KConfigGroup.

◆ groupImpl() [2/2]

virtual KConfigGroup KConfigBase::groupImpl ( const QString & groupName)
protectedpure virtual
Parameters
groupNamename of group

Implemented in KConfig, and KConfigGroup.

◆ groupList()

virtual QStringList KConfigBase::groupList ( ) const
pure virtual

Returns a list of groups that are known about.

Returns
The list of groups.

Implemented in KConfig, and KConfigGroup.

◆ hasGroup()

bool KConfigBase::hasGroup ( const QString & group) const

Returns true if the specified group is known about.

Parameters
groupname of group to search for
Returns
true if the group exists.

Definition at line 16 of file kconfigbase.cpp.

◆ hasGroupImpl()

virtual bool KConfigBase::hasGroupImpl ( const QString & groupName) const
protectedpure virtual
Parameters
groupNamename of group

Implemented in KConfig, and KConfigGroup.

◆ isGroupImmutable()

bool KConfigBase::isGroupImmutable ( const QString & group) const

Can changes be made to the entries in group?

Parameters
groupThe group to check for immutability.
Returns
false if the entries in group can be modified, otherwise true

Definition at line 36 of file kconfigbase.cpp.

◆ isGroupImmutableImpl()

virtual bool KConfigBase::isGroupImmutableImpl ( const QString & groupName) const
protectedpure virtual
Parameters
groupNamename of group

Implemented in KConfig, and KConfigGroup.

◆ isImmutable()

virtual bool KConfigBase::isImmutable ( ) const
pure virtual

Checks whether this configuration object can be modified.

Returns
whether changes may be made to this configuration object.

Implemented in KConfig, and KConfigGroup.

◆ markAsClean()

virtual void KConfigBase::markAsClean ( )
pure virtual

Reset the dirty flags of all entries in the entry map, so the values will not be written to disk on a later call to sync().

Implemented in KConfig, and KConfigGroup.

◆ sync()

virtual bool KConfigBase::sync ( )
pure virtual

Syncs the configuration object that this group belongs to.

Unrelated concurrent changes to the same file are merged and thus not overwritten. Note however, that this object is not automatically updated with those changes.

Implemented in KConfig, and KConfigGroup.

◆ virtual_hook()

void KConfigBase::virtual_hook ( int id,
void * data )
protectedvirtual

Virtual hook, used to add new "virtual" functions while maintaining binary compatibility.

Unused in this class.

Reimplemented in KConfig.

Definition at line 49 of file kconfigbase.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:03:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.