summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/settings.h
Unidiff
Diffstat (limited to 'noncore/games/sfcave-sdl/settings.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/settings.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/noncore/games/sfcave-sdl/settings.h b/noncore/games/sfcave-sdl/settings.h
new file mode 100644
index 0000000..5e828ed
--- a/dev/null
+++ b/noncore/games/sfcave-sdl/settings.h
@@ -0,0 +1,52 @@
1#ifndef __SETTINGS_H
2#define __SETTINGS_H
3
4// This class will create a .<name> directory in the users home directory or
5// a directory for the users choice. It will then manage a set of key values
6// that the programmer can search for. This allows programmers to save a users
7// settings and then retrieve then at a latter time. It currently supports
8// upto 1024 different settings.
9// Two constructors are provided. They will dertermine what directory to look
10// for the settings file and what the name of the file is. If the directory is
11// not specified then a default directory of .<DEFAULT_DIR> will be created in
12// the users home directory. A file will be created in this directory. The name
13// will be the one specified by the caller. If none is specified then
14// DEFAULT_FILE will be created.
15// To retrieve and store strings into the file readSetting and writeSetting
16// should be called.
17
18#include <string>
19using namespace std;
20
21class Settings
22{
23
24public:
25
26 Settings( char * env_file = 0, char * env_dir = 0 );
27 Settings();
28 ~Settings();
29
30 bool readSetting(const string key_str,string& results);
31 bool readSetting(const string key_str,int& result);
32 bool readSetting(const string key_str,unsigned int& result);
33 bool readSetting(const string key_str,long int& result);
34 bool readSetting(const string key_str,unsigned long& result);
35 bool readSetting(const string key_str,bool& result);
36
37 void writeSetting(const string key_str,const string value);
38 void writeSetting(const string key_str,const int value);
39 void writeSetting(const string key_str,const unsigned int result);
40 void writeSetting(const string key_str,const long int result);
41 void writeSetting(const string key_str,const unsigned long result);
42 void writeSetting(const string key_str,const bool value);
43
44 void deleteFile(void);
45
46private:
47
48 string envFile;
49};
50
51
52#endif