Diffstat (limited to 'inputmethods/dasher/SettingsStore.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | inputmethods/dasher/SettingsStore.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/inputmethods/dasher/SettingsStore.cpp b/inputmethods/dasher/SettingsStore.cpp index f7661bd..7e0fa58 100644 --- a/inputmethods/dasher/SettingsStore.cpp +++ b/inputmethods/dasher/SettingsStore.cpp | |||
@@ -1,66 +1,71 @@ | |||
1 | // SettingsStore.cpp | 1 | // SettingsStore.cpp |
2 | // | 2 | // |
3 | ///////////////////////////////////////////////////////////////////////////// | 3 | ///////////////////////////////////////////////////////////////////////////// |
4 | // | 4 | // |
5 | // Copyright (c) 2002 Iain Murray | 5 | // Copyright (c) 2002 Iain Murray |
6 | // | 6 | // |
7 | ///////////////////////////////////////////////////////////////////////////// | 7 | ///////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | 11 | ||
12 | #include "SettingsStore.h" | 12 | #include "SettingsStore.h" |
13 | 13 | ||
14 | using namespace std; | 14 | using namespace std; |
15 | 15 | ||
16 | /* TODO: Consider using Template functions to make this neater. */ | 16 | /* TODO: Consider using Template functions to make this neater. */ |
17 | 17 | ||
18 | 18 | ||
19 | CSettingsStore::~CSettingsStore() | ||
20 | { | ||
21 | } | ||
22 | |||
23 | |||
19 | bool CSettingsStore::GetBoolOption(const string& Key) | 24 | bool CSettingsStore::GetBoolOption(const string& Key) |
20 | { | 25 | { |
21 | if (BoolMap.find(Key)==BoolMap.end()) { | 26 | if (BoolMap.find(Key)==BoolMap.end()) { |
22 | bool Value = false; | 27 | bool Value = false; |
23 | LoadSetting(Key, &Value); | 28 | LoadSetting(Key, &Value); |
24 | BoolMap[Key] = Value; | 29 | BoolMap[Key] = Value; |
25 | } | 30 | } |
26 | 31 | ||
27 | return BoolMap[Key]; | 32 | return BoolMap[Key]; |
28 | } | 33 | } |
29 | 34 | ||
30 | 35 | ||
31 | long CSettingsStore::GetLongOption(const string& Key) | 36 | long CSettingsStore::GetLongOption(const string& Key) |
32 | { | 37 | { |
33 | if (LongMap.find(Key)==LongMap.end()) { | 38 | if (LongMap.find(Key)==LongMap.end()) { |
34 | long Value = 0l; | 39 | long Value = 0l; |
35 | LoadSetting(Key, &Value); | 40 | LoadSetting(Key, &Value); |
36 | LongMap[Key] = Value; | 41 | LongMap[Key] = Value; |
37 | } | 42 | } |
38 | 43 | ||
39 | return LongMap[Key]; | 44 | return LongMap[Key]; |
40 | } | 45 | } |
41 | 46 | ||
42 | 47 | ||
43 | string& CSettingsStore::GetStringOption(const string& Key) | 48 | string& CSettingsStore::GetStringOption(const string& Key) |
44 | { | 49 | { |
45 | if (StringMap.find(Key)==StringMap.end()) { | 50 | if (StringMap.find(Key)==StringMap.end()) { |
46 | string Value = ""; | 51 | string Value = ""; |
47 | LoadSetting(Key, &Value); | 52 | LoadSetting(Key, &Value); |
48 | StringMap[Key] = Value; | 53 | StringMap[Key] = Value; |
49 | } | 54 | } |
50 | 55 | ||
51 | return StringMap[Key]; | 56 | return StringMap[Key]; |
52 | } | 57 | } |
53 | 58 | ||
54 | 59 | ||
55 | void CSettingsStore::SetBoolOption(const string& Key, bool Value) | 60 | void CSettingsStore::SetBoolOption(const string& Key, bool Value) |
56 | { | 61 | { |
57 | BoolMap[Key] = Value; | 62 | BoolMap[Key] = Value; |
58 | SaveSetting(Key, Value); | 63 | SaveSetting(Key, Value); |
59 | } | 64 | } |
60 | 65 | ||
61 | 66 | ||
62 | void CSettingsStore::SetLongOption(const string& Key, long Value) | 67 | void CSettingsStore::SetLongOption(const string& Key, long Value) |
63 | { | 68 | { |
64 | LongMap[Key] = Value; | 69 | LongMap[Key] = Value; |
65 | SaveSetting(Key, Value); | 70 | SaveSetting(Key, Value); |
66 | } | 71 | } |