From 92419b025aa5d82bb7592281af5505ff931c2e58 Mon Sep 17 00:00:00 2001 From: andyq Date: Mon, 20 Jan 2003 23:11:56 +0000 Subject: Initial Revision --- (limited to 'noncore/games/sfcave-sdl/settings.h') 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 @@ +#ifndef __SETTINGS_H +#define __SETTINGS_H + +// This class will create a . directory in the users home directory or +// a directory for the users choice. It will then manage a set of key values +// that the programmer can search for. This allows programmers to save a users +// settings and then retrieve then at a latter time. It currently supports +// upto 1024 different settings. +// Two constructors are provided. They will dertermine what directory to look +// for the settings file and what the name of the file is. If the directory is +// not specified then a default directory of . will be created in +// the users home directory. A file will be created in this directory. The name +// will be the one specified by the caller. If none is specified then +// DEFAULT_FILE will be created. +// To retrieve and store strings into the file readSetting and writeSetting +// should be called. + +#include +using namespace std; + +class Settings +{ + +public: + + Settings( char * env_file = 0, char * env_dir = 0 ); + Settings(); + ~Settings(); + + bool readSetting(const string key_str,string& results); + bool readSetting(const string key_str,int& result); + bool readSetting(const string key_str,unsigned int& result); + bool readSetting(const string key_str,long int& result); + bool readSetting(const string key_str,unsigned long& result); + bool readSetting(const string key_str,bool& result); + + void writeSetting(const string key_str,const string value); + void writeSetting(const string key_str,const int value); + void writeSetting(const string key_str,const unsigned int result); + void writeSetting(const string key_str,const long int result); + void writeSetting(const string key_str,const unsigned long result); + void writeSetting(const string key_str,const bool value); + + void deleteFile(void); + +private: + + string envFile; +}; + + +#endif -- cgit v0.9.0.2