KConfigBase Class
Interface to interact with configuration. More...
Header: | #include <KConfigBase> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Config) target_link_libraries(mytarget PRIVATE KF6::ConfigCore) |
Inherited By: | KConfig and KConfigGroup |
Public Types
enum | AccessMode { NoAccess, ReadOnly, ReadWrite } |
enum | WriteConfigFlag { Persistent, Global, Localized, Notify, Normal } |
flags | WriteConfigFlags |
Public Functions
virtual | ~KConfigBase() |
virtual KConfigBase::AccessMode | accessMode() const = 0 |
void | deleteGroup(const QString &group, KConfigBase::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 Functions
virtual void | virtual_hook(int id, void *data) |
Detailed Description
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.
Member Type Documentation
enum KConfigBase::AccessMode
Possible return values for accessMode().
enum KConfigBase::WriteConfigFlag
flags KConfigBase::WriteConfigFlags
Flags to control write entry @see WriteConfigFlags
The WriteConfigFlags type is a typedef for QFlags<WriteConfigFlag>. It stores an OR combination of WriteConfigFlag values.
Member Function Documentation
[virtual noexcept]
KConfigBase::~KConfigBase()
Destructs the KConfigBase object.
[pure virtual]
KConfigBase::AccessMode KConfigBase::accessMode() const
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).
@return the access mode of the app-config object
void KConfigBase::deleteGroup(const QString &group, KConfigBase::WriteConfigFlags flags = Normal)
Delete @p group. This marks @p group as @em deleted in the config object. This effectively removes any cascaded values from config files earlier in the stack.
KConfigGroup KConfigBase::group(const QString &group)
Returns an object for the named subgroup.
@param group the group to open. Pass an empty string here to the KConfig object to obtain a handle on the root group. @return config group object for the given group name.
const KConfigGroup KConfigBase::group(const QString &group) const
Const overload for group(const QString&)
[pure virtual]
QStringList KConfigBase::groupList() const
Returns a list of groups that are known about.
@return The list of groups.
bool KConfigBase::hasGroup(const QString &group) const
Returns true if the specified group is known about.
@param group name of group to search for @return true if the group exists.
bool KConfigBase::isGroupImmutable(const QString &group) const
Can changes be made to the entries in @p group?
@param group The group to check for immutability. @return @c false if the entries in @p group can be modified, otherwise @c true
[pure virtual]
bool KConfigBase::isImmutable() const
Checks whether this configuration object can be modified. @return whether changes may be made to this configuration object.
[pure virtual]
void KConfigBase::markAsClean()
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().
[pure virtual]
bool KConfigBase::sync()
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 @em not automatically updated with those changes.
[virtual protected]
void KConfigBase::virtual_hook(int id, void *data)
Virtual hook, used to add new "virtual" functions while maintaining binary compatibility. Unused in this class.