KSharedConfig
#include <KSharedConfig>
Public Types | |
typedef QExplicitlySharedDataPointer< KSharedConfig > | Ptr |
Public Types inherited from KConfig | |
enum | OpenFlag { IncludeGlobals = 0x01 , CascadeConfig = 0x02 , SimpleConfig = 0x00 , NoCascade = IncludeGlobals , NoGlobals = CascadeConfig , FullConfig = IncludeGlobals | CascadeConfig } |
typedef QFlags< OpenFlag > | OpenFlags |
Public Types inherited from KConfigBase | |
enum | AccessMode { NoAccess , ReadOnly , ReadWrite } |
enum | WriteConfigFlag { Persistent = 0x01 , Global = 0x02 , Localized = 0x04 , Notify = 0x08 | Persistent , Normal = Persistent } |
typedef QFlags< WriteConfigFlag > | WriteConfigFlags |
Static Public Member Functions | |
static KSharedConfig::Ptr | openConfig (const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation) |
static KSharedConfig::Ptr | openStateConfig (const QString &fileName=QString()) |
Static Public Member Functions inherited from KConfig | |
static QString | mainConfigName () |
static void | setMainConfigName (const QString &str) |
Additional Inherited Members | |
Public Member Functions inherited from KConfig | |
KConfig (const QString &file, const QString &backend, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation) | |
KConfig (const QString &file=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation) | |
void | checkUpdate (const QString &id, const QString &updateFile) |
KConfig * | copyTo (const QString &file, KConfig *config=nullptr) const |
QMap< QString, QString > | entryMap (const QString &aGroup=QString()) const |
QStringList | groupList () const override |
bool | isDirty () const |
QStandardPaths::StandardLocation | locationType () const |
void | markAsClean () override |
QString | name () const |
OpenFlags | openFlags () const |
void | reparseConfiguration () |
bool | sync () override |
AccessMode | accessMode () const override |
bool | isConfigWritable (bool warnUser) |
void | addConfigSources (const QStringList &sources) |
QStringList | additionalConfigSources () const |
QString | locale () const |
bool | setLocale (const QString &aLocale) |
void | setReadDefaults (bool b) |
bool | readDefaults () const |
bool | isImmutable () const override |
Public Member Functions inherited from KConfigBase | |
virtual | ~KConfigBase () |
void | deleteGroup (const QString &group, WriteConfigFlags flags=Normal) |
KConfigGroup | group (const QString &group) |
const KConfigGroup | group (const QString &group) const |
bool | hasGroup (const QString &group) const |
bool | isGroupImmutable (const QString &group) const |
Public Member Functions inherited from QSharedData | |
QSharedData (const QSharedData &) | |
Protected Member Functions inherited from KConfig | |
KCONFIGCORE_NO_EXPORT | KConfig (KConfigPrivate &d) |
void | deleteGroupImpl (const QString &groupName, WriteConfigFlags flags=Normal) override |
bool | hasGroupImpl (const QString &groupName) const override |
bool | isGroupImmutableImpl (const QString &groupName) const override |
void | virtual_hook (int id, void *data) override |
Protected Member Functions inherited from KConfigBase | |
Protected Attributes inherited from KConfig | |
KConfigPrivate *const | d_ptr |
Detailed Description
KConfig variant using shared memory.
KSharedConfig provides a shared (reference counted) variant of KConfig. This allows you to use/manipulate the same configuration files from different places in your code without worrying about accidentally overwriting changes.
The openConfig() method is threadsafe: every thread gets a separate repository of shared KConfig objects. This means, however, that you'll be responsible for synchronizing the instances of KConfig for the same filename between threads, using KConfig::reparseConfiguration() after a manual change notification, just like you have to do between processes.
Definition at line 31 of file ksharedconfig.h.
Member Typedef Documentation
◆ Ptr
Definition at line 34 of file ksharedconfig.h.
Constructor & Destructor Documentation
◆ ~KSharedConfig()
|
override |
Definition at line 185 of file ksharedconfig.cpp.
Member Function Documentation
◆ openConfig()
|
static |
Creates a KSharedConfig object to manipulate a configuration file.
If an absolute path is specified for fileName
, that file will be used as the store for the configuration settings. If a non-absolute path is provided, the file will be looked for in the standard directory specified by type
. If no path is provided, a default configuration file will be used based on the name of the main application component.
mode
determines whether the user or global settings will be allowed to influence the values returned by this object. See KConfig::OpenFlags for more details.
- Parameters
-
fileName the configuration file to open. If empty, it will be determined automatically (from –config on the command line, otherwise from the application name + "rc") mode how global settings should affect the configuration options exposed by this KConfig object type The standard directory to look for the configuration file in (see QStandardPaths)
- See also
- KConfig
Definition at line 124 of file ksharedconfig.cpp.
◆ openStateConfig()
|
static |
Creates a KSharedConfig object to manipulate a configuration file suitable for storing state information.
Use this for storing information that is changing frequently and should not be saved by configuration backup utilities.
If an absolute path is specified for fileName
, that file will be used as the store for the configuration settings. If a non-absolute path is provided, the file will be looked for in the standard data directory (QStandardPaths::AppDataLocation). If no path is provided, a default configuration file will be used based on the name of the main application component.
- Parameters
-
fileName the configuration file to open. If empty, it will be determined automatically from the application name + "staterc"
- Since
- 5.67
- See also
- KConfig
Definition at line 166 of file ksharedconfig.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.