blob: bb7d2e69c2d5589bb066eca0d2aca8ae6fe15cdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/*
* Copyright (c) 2010 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <Swift/Controllers/Settings/SettingsProvider.h>
#include <map>
namespace Swift {
class DummySettingsProvider : public SettingsProvider {
public:
virtual ~DummySettingsProvider() {}
virtual std::string getSetting(const Setting<std::string>& setting) {
return stringValues.find(setting.getKey()) != stringValues.end() ? stringValues[setting.getKey()] : setting.getDefaultValue();
};
virtual void storeSetting(const Setting<std::string>& setting, const std::string& value) {
stringValues[setting.getKey()] = value;
onSettingChanged(setting.getKey());
};
virtual bool getSetting(const Setting<bool>& setting) {
return boolValues.find(setting.getKey()) != boolValues.end() ? boolValues[setting.getKey()] : setting.getDefaultValue();
};
virtual void storeSetting(const Setting<bool>& setting, const bool& value) {
boolValues[setting.getKey()] = value;
onSettingChanged(setting.getKey());
};
virtual int getSetting(const Setting<int>& setting) {
return intValues.find(setting.getKey()) != intValues.end() ? intValues[setting.getKey()] : setting.getDefaultValue();
};
virtual void storeSetting(const Setting<int>& setting, const int& value) {
intValues[setting.getKey()] = value;
onSettingChanged(setting.getKey());
};
virtual std::vector<std::string> getAvailableProfiles() {return std::vector<std::string>();}
virtual void createProfile(const std::string& ) {}
virtual void removeProfile(const std::string& ) {}
virtual bool getIsSettingFinal(const std::string& ) {return false;}
private:
std::map<std::string, std::string> stringValues;
std::map<std::string, int> intValues;
std::map<std::string, bool> boolValues;
};
}
|