diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-25 19:41:12 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-25 19:42:11 +0200 |
commit | 7fd6c9e83593f51326ea0ed745f4b22b6bb3701b (patch) | |
tree | 4ad45b624de06458a131b88adb81616cfe611e77 /opentrack-compat/options.cpp | |
parent | 13edf283fc5c6a35d262a13e5cbdceb8013ba81e (diff) |
compat/options: konst korrektness
Diffstat (limited to 'opentrack-compat/options.cpp')
-rw-r--r-- | opentrack-compat/options.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/opentrack-compat/options.cpp b/opentrack-compat/options.cpp index 9dcb10ab..4f8da9f7 100644 --- a/opentrack-compat/options.cpp +++ b/opentrack-compat/options.cpp @@ -26,7 +26,7 @@ group::group(const QString& name) : name(name) conf->endGroup(); } -void group::save() +void group::save() const { auto s = ini_file(); s->beginGroup(name); @@ -41,7 +41,7 @@ void group::put(const QString &s, const QVariant &d) kvs[s] = d; } -bool group::contains(const QString &s) +bool group::contains(const QString &s) const { return kvs.count(s) != 0; } @@ -120,9 +120,9 @@ void impl_bundle::store_kv(const QString &name, const QVariant &datum) } } -bool impl_bundle::contains(const QString &name) +bool impl_bundle::contains(const QString &name) const { - QMutexLocker l(&mtx); + QMutexLocker l(const_cast<QMutex*>(&mtx)); return transient.contains(name); } @@ -137,9 +137,9 @@ void impl_bundle::save() emit saving(); } -bool impl_bundle::modifiedp() +bool impl_bundle::modifiedp() const { - QMutexLocker l(&mtx); + QMutexLocker l(const_cast<QMutex*>(&mtx)); return modified; } @@ -156,7 +156,7 @@ pbundle opt_singleton::bundle(const opt_singleton::k &key) if (shared != nullptr) return shared; } - + qDebug() << "bundle +" << key; auto shr = std::make_shared<v>(key); @@ -196,4 +196,12 @@ opts::~opts() opts::opts(const QString &name) : b(bundle(name)) {} +pbundle bundle(const QString& name) +{ + return detail::singleton().bundle(name); +} + + + +// end } |