4 #include "SettingsHandler.h"
6 void SetUpSettings(char* filename
);
9 class StringValueSetting
: public SettingsArgvDispatcher
{
10 // simple string setting
12 StringValueSetting(const char* name
,
13 const char* defaultValue
,
14 const char* valueExpectedErrorString
,
15 const char* wrongValueErrorString
= "");
17 virtual ~StringValueSetting();
19 void ValueChanged(const char* newValue
);
20 const char* Value() const;
21 virtual const char* Handle(const char *const *argv
);
24 virtual void SaveSettingValue(Settings
*);
25 virtual bool NeedsSaving() const;
27 const char* fDefaultValue
;
28 const char* fValueExpectedErrorString
;
29 const char* fWrongValueErrorString
;
34 // string setting, values that do not match string enumeration
36 class EnumeratedStringValueSetting
: public StringValueSetting
{
38 // A pointer to a function returning a string for an index, or NULL
39 // if the index is out of bounds.
40 typedef const char* (*StringEnumerator
)(int32
);
42 EnumeratedStringValueSetting(const char* name
,
43 const char* defaultValue
,
44 StringEnumerator enumerator
,
45 const char* valueExpectedErrorString
,
46 const char* wrongValueErrorString
);
48 void ValueChanged(const char* newValue
);
49 virtual const char* Handle(const char *const *argv
);
52 bool _ValidateString(const char* string
);
53 StringEnumerator fEnumerator
;
57 // simple int32 setting
58 class ScalarValueSetting
: public SettingsArgvDispatcher
{
60 ScalarValueSetting(const char* name
,
62 const char* valueExpectedErrorString
,
63 const char* wrongValueErrorString
,
64 int32 min
= INT32_MIN
, int32 max
= INT32_MAX
);
65 virtual ~ScalarValueSetting();
67 void ValueChanged(int32 newValue
);
69 void GetValueAsString(char*) const;
70 virtual const char* Handle(const char *const *argv
);
73 virtual void SaveSettingValue(Settings
*);
74 virtual bool NeedsSaving() const;
80 const char* fValueExpectedErrorString
;
81 const char* fWrongValueErrorString
;
85 class BooleanValueSetting
: public ScalarValueSetting
{
87 BooleanValueSetting(const char* name
,
89 virtual ~BooleanValueSetting();
92 virtual const char* Handle(const char *const *argv
);
95 virtual void SaveSettingValue(Settings
*);