Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

SettingsStore.h

Go to the documentation of this file.
00001 // SettingsStore.h
00002 //
00004 //
00005 // Copyright (c) 2002 Iain Murray
00006 //
00008 
00009 
00010 
00011 #ifndef __SettingsStore_h__
00012 #define __SettingsStore_h__
00013 
00014 
00015 #include "../Common/MSVC_Unannoy.h"
00016 #include <string>
00017 #include <map>
00018 
00019 
00020 /*
00021         The public interface uses UTF-8 strings. All Keys should be
00022         in American English and encodable in ASCII. However,
00023         string Values may contain special characters where appropriate.
00024 */
00025 
00026 
00027 class CSettingsStore
00028 {
00029 public:
00030         bool GetBoolOption(const std::string& Key);
00031         long GetLongOption(const std::string& Key);
00032         std::string& GetStringOption(const std::string& Key);
00033 
00034         void SetBoolOption(const std::string& Key, bool Value);
00035         void SetLongOption(const std::string& Key, long Value);
00036         void SetStringOption(const std::string& Key, const std::string& Value);
00037         
00038         void SetBoolDefault(const std::string& Key, bool Value);
00039         void SetLongDefault(const std::string& Key, long Value);
00040         void SetStringDefault(const std::string& Key, const std::string& Value);        
00041 private:
00042         // Platform Specific settings file management
00043 
00044         // LoadSetting changes Value only if it succeeds in loading the setting,
00045         // in which case it also returns true. Failure is indicated by returning false.
00047         //
00051         virtual bool LoadSetting(const std::string& Key, bool* Value);
00052 
00054         //
00058         virtual bool LoadSetting(const std::string& Key, long* Value);
00059 
00061         //
00065         virtual bool LoadSetting(const std::string& Key, std::string* Value);
00066         
00068         //
00071         virtual void SaveSetting(const std::string& Key, bool Value);
00072 
00074         //
00077         virtual void SaveSetting(const std::string& Key, long Value);
00078 
00080         //
00083         virtual void SaveSetting(const std::string& Key, const std::string& Value);
00084         
00085         // Used to store settings in memory
00086         std::map<std::string, bool> BoolMap;
00087         std::map<std::string, long> LongMap;
00088         std::map<std::string, std::string> StringMap;
00089 };
00090 
00091 
00092 #endif /* #ifndef __SettingsStore_h__ */

Generated on Fri Mar 7 23:23:13 2003 for Dasher by doxygen1.3-rc3