From 651b6c612db4e809c506973996f2580c4158ac3a Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sat, 27 Sep 2003 11:29:26 +0000 Subject: merge dasher which has been introduced in BRANCH first (wtf?) into HEAD --- (limited to 'inputmethods/dasher/SettingsStore.h') diff --git a/inputmethods/dasher/SettingsStore.h b/inputmethods/dasher/SettingsStore.h new file mode 100644 index 0000000..8ef9fcf --- a/dev/null +++ b/inputmethods/dasher/SettingsStore.h @@ -0,0 +1,92 @@ +// SettingsStore.h +// +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2002 Iain Murray +// +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef __SettingsStore_h__ +#define __SettingsStore_h__ + + +#include "MSVC_Unannoy.h" +#include +#include + + +/* + The public interface uses UTF-8 strings. All Keys should be + in American English and encodable in ASCII. However, + string Values may contain special characters where appropriate. +*/ + + +class CSettingsStore +{ +public: + bool GetBoolOption(const std::string& Key); + long GetLongOption(const std::string& Key); + std::string& GetStringOption(const std::string& Key); + + void SetBoolOption(const std::string& Key, bool Value); + void SetLongOption(const std::string& Key, long Value); + void SetStringOption(const std::string& Key, const std::string& Value); + + void SetBoolDefault(const std::string& Key, bool Value); + void SetLongDefault(const std::string& Key, long Value); + void SetStringDefault(const std::string& Key, const std::string& Value); +private: + // Platform Specific settings file management + + // LoadSetting changes Value only if it succeeds in loading the setting, + // in which case it also returns true. Failure is indicated by returning false. + //! Load a setting with a boolean value + // + //! Load a setting with a boolean value. Return true if successful + //! \param Key Name of the setting + //! \param Value Value of the setting + virtual bool LoadSetting(const std::string& Key, bool* Value); + + //! Load a setting with a long value + // + //! Load a setting with a long value. Return true if successful + //! \param Key Name of the setting + //! \param Value Value of the setting + virtual bool LoadSetting(const std::string& Key, long* Value); + + //! Load a setting with a string value + // + //! Load a setting with a string value. Return true if successful + //! \param Key Name of the setting + //! \param Value Value of the setting, UTF8 encoded + virtual bool LoadSetting(const std::string& Key, std::string* Value); + + //! Save a setting with a boolean value + // + //! \param Key Name of the setting + //! \param Value Value of the setting + virtual void SaveSetting(const std::string& Key, bool Value); + + //! Save a setting with a long value + // + //! \param Key Name of the setting + //! \param Value Value of the setting + virtual void SaveSetting(const std::string& Key, long Value); + + //! Save a setting with a string value + // + //! \param Key Name of the setting + //! \param Value Value of the setting, UTF8 encoded + virtual void SaveSetting(const std::string& Key, const std::string& Value); + + // Used to store settings in memory + std::map BoolMap; + std::map LongMap; + std::map StringMap; +}; + + +#endif /* #ifndef __SettingsStore_h__ */ -- cgit v0.9.0.2