QSettings-backed configuration backend (INI format).
More...
#include <phosphor-config/include/PhosphorConfig/QSettingsBackend.h>
Public Member Functions | |
| QSettingsBackend (const QString &filePath) | |
| ~QSettingsBackend () override | |
| std::unique_ptr< IGroup > | group (const QString &name) override |
| Return a scoped view into the named group. | |
| void | reparseConfiguration () override |
| Re-read configuration from disk, discarding any pending in-memory changes. | |
| bool | sync () override |
| Flush pending writes to disk. | |
| void | deleteGroup (const QString &name) override |
| Delete an entire group and everything inside it. | |
| QString | readRootString (const QString &key, const QString &defaultValue={}) const override |
| Read/write ungrouped (root-level) keys. | |
| void | writeRootString (const QString &key, const QString &value) override |
| void | removeRootKey (const QString &key) override |
| QStringList | groupList () const override |
| Enumerate every top-level group name. | |
Public Member Functions inherited from PhosphorConfig::IBackend | |
| virtual | ~IBackend ()=default |
| virtual void | setPathResolver (std::shared_ptr< IGroupPathResolver >) |
| Install a group-path resolver. | |
| virtual std::shared_ptr< IGroupPathResolver > | pathResolver () const |
Currently-installed resolver, or nullptr when none is set (also the default for backends that ignore setPathResolver). | |
| virtual void | setVersionStamp (const QString &, int) |
Install a "stamp on first sync" version annotation: if key is absent from the backend's root on the next flush, write key = version. | |
| virtual std::pair< QString, int > | versionStamp () const |
Currently-installed version stamp as {key, version}. | |
| virtual bool | applyMigration (const Schema &) |
Apply schema's migration chain against the backend's in-memory state and commit any resulting version bump. | |
| IBackend (const IBackend &)=delete | |
| IBackend & | operator= (const IBackend &)=delete |
Static Public Member Functions | |
| static QMap< QString, QVariant > | readConfigFromDisk (const QString &filePath) |
| Read an INI config from an arbitrary file path, bypassing Qt's QConfFile cache. | |
Additional Inherited Members | |
Protected Member Functions inherited from PhosphorConfig::IBackend | |
| IBackend ()=default | |
QSettings-backed configuration backend (INI format).
Primarily exists to read legacy INI files during a one-time migration to the JSON backend. New consumers should prefer JsonBackend.
|
explicit |
|
override |
|
overridevirtual |
Delete an entire group and everything inside it.
Intermediate parents are pruned if they become empty (dot-path groups only).
Implements PhosphorConfig::IBackend.
|
overridevirtual |
Return a scoped view into the named group.
Caller owns the pointer; destroy it before asking for another group on this backend.
Implements PhosphorConfig::IBackend.
|
overridevirtual |
Enumerate every top-level group name.
Dot-path groups are returned with their full path ("Snapping", "Snapping.Behavior", ...). Groups produced by a plugged-in IGroupPathResolver appear in the resolver's preferred external form.
Implements PhosphorConfig::IBackend.
|
static |
Read an INI config from an arbitrary file path, bypassing Qt's QConfFile cache.
Returns a flat QMap keyed by "Group/Key". Used by migration chains that want to consume a legacy INI without installing it as an active QSettings source.
|
overridevirtual |
Read/write ungrouped (root-level) keys.
Implements PhosphorConfig::IBackend.
|
overridevirtual |
Implements PhosphorConfig::IBackend.
|
overridevirtual |
Re-read configuration from disk, discarding any pending in-memory changes.
Must not be called while a group view is live.
Implements PhosphorConfig::IBackend.
|
overridevirtual |
Flush pending writes to disk.
No-op when nothing is dirty. Returns true on success (or when there was nothing to flush), false on an I/O error — backends log the reason before returning.
Implements PhosphorConfig::IBackend.
|
overridevirtual |
Implements PhosphorConfig::IBackend.