You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
747 B
39 lines
747 B
6 years ago
|
#include "testbackend.h"
|
||
|
|
||
|
TestBackend::TestBackend(QObject *parent) :
|
||
|
ISettingsAccessor{parent}
|
||
|
{}
|
||
|
|
||
|
bool TestBackend::contains(const QString &key) const
|
||
|
{
|
||
|
return _data.contains(key);
|
||
|
}
|
||
|
|
||
|
QVariant TestBackend::load(const QString &key, const QVariant &defaultValue) const
|
||
|
{
|
||
|
return _data.value(key, defaultValue);
|
||
|
}
|
||
|
|
||
|
void TestBackend::save(const QString &key, const QVariant &value)
|
||
|
{
|
||
|
_data.insert(key, value);
|
||
|
emit entryChanged(key, value);
|
||
|
}
|
||
|
|
||
|
void TestBackend::remove(const QString &key)
|
||
|
{
|
||
|
for(auto it = _data.begin(); it != _data.end();) {
|
||
|
if(it.key().startsWith(key + QLatin1Char('/'))) {
|
||
|
it = _data.erase(it);
|
||
|
emit entryRemoved(key);
|
||
|
} else
|
||
|
++it;
|
||
|
}
|
||
|
_data.remove(key);
|
||
|
emit entryRemoved(key);
|
||
|
}
|
||
|
|
||
|
void TestBackend::sync()
|
||
|
{
|
||
|
}
|