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

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 "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         virtual ~CSettingsStore();
00031         bool GetBoolOption(const std::string& Key);
00032         long GetLongOption(const std::string& Key);
00033         std::string& GetStringOption(const std::string& Key);
00034 
00035         void SetBoolOption(const std::string& Key, bool Value);
00036         void SetLongOption(const std::string& Key, long Value);
00037         void SetStringOption(const std::string& Key, const std::string& Value);
00038         
00039         void SetBoolDefault(const std::string& Key, bool Value);
00040         void SetLongDefault(const std::string& Key, long Value);
00041         void SetStringDefault(const std::string& Key, const std::string& Value);        
00042 private:
00043         // Platform Specific settings file management
00044 
00045         // LoadSetting changes Value only if it succeeds in loading the setting,
00046         // in which case it also returns true. Failure is indicated by returning false.
00048         //
00052         virtual bool LoadSetting(const std::string& Key, bool* Value);
00053 
00055         //
00059         virtual bool LoadSetting(const std::string& Key, long* Value);
00060 
00062         //
00066         virtual bool LoadSetting(const std::string& Key, std::string* Value);
00067         
00069         //
00072         virtual void SaveSetting(const std::string& Key, bool Value);
00073 
00075         //
00078         virtual void SaveSetting(const std::string& Key, long Value);
00079 
00081         //
00084         virtual void SaveSetting(const std::string& Key, const std::string& Value);
00085         
00086         // Used to store settings in memory
00087         std::map<std::string, bool> BoolMap;
00088         std::map<std::string, long> LongMap;
00089         std::map<std::string, std::string> StringMap;
00090 };
00091 
00092 
00093 #endif /* #ifndef __SettingsStore_h__ */

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