Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

settings.h

Go to the documentation of this file.
00001 #ifndef __SETTINGS_H
00002 #define __SETTINGS_H
00003 
00004 // This class will create a .<name> directory in the users home directory or
00005 // a directory for the users choice. It will then manage a set of key values
00006 // that the programmer can search for. This allows programmers to save a users
00007 // settings and then retrieve then at a latter time. It currently supports
00008 // upto 1024 different settings.
00009 // Two constructors are provided. They will dertermine what directory to look
00010 // for the settings file and what the name of the file is. If the directory is
00011 // not specified then a default directory of .<DEFAULT_DIR> will be created in
00012 // the users home directory. A file will be created in this directory. The name
00013 // will be the one specified by the caller. If none is specified then
00014 // DEFAULT_FILE will be created.
00015 // To retrieve and store strings into the file readSetting and writeSetting
00016 // should be called.
00017 
00018 #include <string>
00019 using namespace std;
00020 
00021 class Settings
00022 {
00023 
00024 public:
00025 
00026    Settings( char * env_file = 0, char * env_dir = 0 );
00027    Settings();
00028    ~Settings();
00029 
00030    bool readSetting(const string key_str,string& results);
00031    bool readSetting(const string key_str,int& result);
00032    bool readSetting(const string key_str,unsigned int& result);
00033    bool readSetting(const string key_str,long int& result);
00034    bool readSetting(const string key_str,unsigned long& result);
00035    bool readSetting(const string key_str,double & result);
00036    bool readSetting(const string key_str,bool& result);
00037 
00038    void writeSetting(const string key_str,const string value);
00039    void writeSetting(const string key_str,const int value);
00040    void writeSetting(const string key_str,const unsigned int result);
00041    void writeSetting(const string key_str,const long int result);
00042    void writeSetting(const string key_str,const unsigned long result);
00043    void writeSetting(const string key_str,const double value);
00044    void writeSetting(const string key_str,const bool value);
00045 
00046    void deleteFile(void);
00047 
00048 private:
00049 
00050         string envFile;
00051 };
00052 
00053 
00054 #endif

Generated on Sat Nov 5 16:17:24 2005 for OPIE by  doxygen 1.4.2