BPS C++ API  2.24.4
bpssettings.h
Go to the documentation of this file.
1 
4 #ifndef BPSSETTINGS_H
5 #define BPSSETTINGS_H
6 
7 #include <QObject>
8 #include <QStringList>
9 #include "bps.h"
10 
11 class BpsDatastore;
12 
17 {
18  Q_OBJECT
19  Q_FLAGS(Scopes)
21 
22 public:
23 
30  enum Scope {
35  NoScope = 0x00000000,
36 
41  LocalUserScope = 0x00000001,
42 
49  LocalInstallScope = 0x00000002,
50 
55  LocalSystemScope = 0x00000004,
56 
61  CentralUserScope = 0x00000010,
62 
67  CentralSystemScope = 0x00000020,
68 
73  LocalScopes = LocalUserScope | LocalInstallScope | LocalSystemScope,
74 
79  CentralScopes = CentralUserScope | CentralSystemScope,
80 
85  AllScopes = LocalScopes | CentralScopes
86 
87  };
88 
89  Q_DECLARE_FLAGS(Scopes, Scope)
90 
91 
100  BpsDatastore* aDatastore,
101  Scope aScope = BpsSettings::LocalUserScope,
102  QObject* aParent = nullptr);
103 
111  Scope aScope = BpsSettings::LocalUserScope,
112  QObject* aParent = nullptr);
113 
114  virtual ~BpsSettings();
115 
119  Scope scope() const;
120 
130  Scope groupScope(const QString& aName, Scopes aSearchedScopes = (Scopes)AllScopes) const;
131 
136  void setScope(Scope aScope);
137 
143  QString root() const;
144 
150  void setRoot(const QString& aRoot);
151 
156  void open(const QString& aPath);
157 
161  void close();
162 
167  void closeAll();
168 
173  QStringList groups() const;
174 
181  bool groupExists(const QString& aGroup) const;
182 
187  QStringList keys() const;
188 
195  bool keyExists(const QString& aKey) const;
196 
203  QVariant value(const QString& aKey, const QVariant& aDefValue = QVariant()) const;
204 
214  QStringList allGroups(Scopes aSearchedScopes = (Scopes)AllScopes) const;
215 
225  QStringList allKeys(Scopes aSearchedScopes = (Scopes)AllScopes) const;
226 
238  QVariant findValue(
239  const QString& aKey,
240  const QVariant& aDefValue = QVariant(),
241  Scopes aSearchedScopes = (Scopes)AllScopes) const;
242 
248  void setValue(const QString& aKey, const QVariant& aValue);
249 
254  void removeKey(const QString& aKey);
255 
261  void removeGroup(const QString& aName);
262 
272  QVariantMap valueMap(Scopes aSearchedScopes = (Scopes)AllScopes) const;
273 
278  void setValueMap(const QVariantMap& aMap);
279 
280 }; // BpsSettings
281 
282 Q_DECLARE_OPERATORS_FOR_FLAGS(BpsSettings::Scopes)
283 
284 #endif // BPSSETTINGS_H
Public include file for Bps class.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
BPS datastore class.
Definition: bpsdatastore.h:61
Query and edit settings.
Definition: bpssettings.h:17
Scope
Scope under which the settings are located.
Definition: bpssettings.h:30
Q_FLAGS(...)