KConfig

kconfigbase.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2006, 2007 Thomas Braxton <[email protected]>
4  SPDX-FileCopyrightText: 2001 Waldo Bastian <[email protected]>
5  SPDX-FileCopyrightText: 1999 Preston Brown <[email protected]>
6  SPDX-FileCopyrightText: 1997 Matthias Kalle Dalheimer <[email protected]>
7 
8  SPDX-License-Identifier: LGPL-2.0-or-later
9 */
10 
11 #ifndef KCONFIGBASE_H
12 #define KCONFIGBASE_H
13 
14 #include <kconfigcore_export.h>
15 
16 #include <QtGlobal>
17 
18 class QStringList;
19 class KConfigGroup;
20 class KConfigBasePrivate;
21 
30 class KCONFIGCORE_EXPORT KConfigBase
31 {
32 public:
38  Persistent = 0x01,
42  Global = 0x02,
47  Localized = 0x04,
51  Notify = 0x08 | Persistent,
57  Normal = Persistent
63  };
68 
69 
72  virtual ~KConfigBase();
73 
79  virtual QStringList groupList() const = 0;
80 
87  bool hasGroup(const QString &group) const;
88  bool hasGroup(const char *group) const;
89  bool hasGroup(const QByteArray &group) const;
90 
98  KConfigGroup group(const QByteArray &group);
99  KConfigGroup group(const QString &group);
100  KConfigGroup group(const char *group);
101 
105  const KConfigGroup group(const QByteArray &group) const;
106  const KConfigGroup group(const QString &group) const;
107  const KConfigGroup group(const char *group) const;
108 
113  void deleteGroup(const QByteArray &group, WriteConfigFlags flags = Normal);
114  void deleteGroup(const QString &group, WriteConfigFlags flags = Normal);
115  void deleteGroup(const char *group, WriteConfigFlags flags = Normal);
116 
123  virtual bool sync() = 0;
124 
129  virtual void markAsClean() = 0;
130 
134  enum AccessMode { NoAccess, ReadOnly, ReadWrite };
135 
148  virtual AccessMode accessMode() const = 0;
149 
154  virtual bool isImmutable() const = 0;
155 
162  bool isGroupImmutable(const QByteArray &aGroup) const;
163  bool isGroupImmutable(const QString &aGroup) const;
164  bool isGroupImmutable(const char *aGroup) const;
165 
166 protected:
167  KConfigBase();
168 
169  virtual bool hasGroupImpl(const QByteArray &group) const = 0;
170  virtual KConfigGroup groupImpl(const QByteArray &b) = 0;
171  virtual const KConfigGroup groupImpl(const QByteArray &b) const = 0;
172  virtual void deleteGroupImpl(const QByteArray &group, WriteConfigFlags flags = Normal) = 0;
173  virtual bool isGroupImmutableImpl(const QByteArray &aGroup) const = 0;
174 
178  virtual void virtual_hook(int id, void *data);
179 };
180 
181 Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBase::WriteConfigFlags)
182 
183 #endif // KCONFIG_H
WriteConfigFlag
Flags to control write entry.
Definition: kconfigbase.h:37
Interface to interact with configuration.
Definition: kconfigbase.h:30
A class for one specific group in a KConfig object.
Definition: kconfiggroup.h:38
AccessMode
Possible return values for accessMode().
Definition: kconfigbase.h:134
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jul 3 2020 22:47:12 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.