Changeset 213

Show
Ignore:
Timestamp:
02/07/08 16:28:56 (4 years ago)
Author:
uncle_fungus
Message:

doxygenated preferenceManager

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.3.2beta3/src/include/preferencesManager.h

    r38 r213  
    1515*/ 
    1616 
     17/** 
     18 * \file preferencesManager.h 
     19 * Manages stored preferences. 
     20 * \author François Ingelrest 
     21 * \author Andrew Schofield 
     22 **/ 
     23 
    1724#ifndef _PREFERENCESMANAGER_H 
    1825#define _PREFERENCESMANAGER_H 
     
    2229#include "preference.h" 
    2330 
    24  
    25 // Macros for retrieving preferences 
    26 // They 'return' the default value if the pref is unknown 
     31/** 
     32 * Macro to get string preference. 
     33 **/ 
    2734#define _PrefsGetString(PREF_NAME, VAR_NAME)                                        \ 
    2835{                                                                                   \ 
     
    3138} 
    3239 
     40/** 
     41 * Macro to get hidden string preference. 
     42 **/ 
    3343#define _PrefsGetHiddenString(PREF_NAME, VAR_NAME)                                        \ 
    3444{                                                                                         \ 
     
    3747} 
    3848 
     49/** 
     50 * Macro to get unsigned integer preference. 
     51 **/ 
    3952#define _PrefsGetUint(PREF_NAME, VAR_NAME)                                        \ 
    4053{                                                                                 \ 
     
    4356} 
    4457 
     58/** 
     59 * Macro to get signed integer preference. 
     60 **/ 
    4561#define _PrefsGetInt(PREF_NAME, VAR_NAME)                                        \ 
    4662{                                                                                \ 
     
    4965} 
    5066 
     67/** 
     68 * Macro to get double preference. 
     69 **/ 
    5170#define _PrefsGetDouble(PREF_NAME, VAR_NAME)                                        \ 
    5271{                                                                                   \ 
     
    5574} 
    5675 
     76/** 
     77 * Macro to get boolean preference. 
     78 **/ 
    5779#define _PrefsGetBool(PREF_NAME, VAR_NAME)                                        \ 
    5880{                                                                                 \ 
     
    6183} 
    6284 
    63  
    64 // Macros for setting preferences 
     85/** 
     86 * Macro to set string preference. 
     87 **/ 
    6588#define _PrefsSetString(PREF_NAME, VAR_NAME)                             \ 
    6689{                                                                       \ 
     
    6891} 
    6992 
     93/** 
     94 * Macro to set hidden string preference. 
     95 **/ 
    7096#define _PrefsSetHiddenString(PREF_NAME, VAR_NAME)                             \ 
    7197{                                                                              \ 
     
    7399} 
    74100 
     101/** 
     102 * Macro to set unsigned integer preference. 
     103 **/ 
    75104#define _PrefsSetUint(PREF_NAME, VAR_NAME)                            \ 
    76105{                                                                     \ 
     
    78107} 
    79108 
     109/** 
     110 * Macro to set signed integer preference. 
     111 **/ 
    80112#define _PrefsSetInt(PREF_NAME, VAR_NAME)                            \ 
    81113{                                                                    \ 
     
    83115} 
    84116 
     117/** 
     118 * Macro to set double preference. 
     119 **/ 
    85120#define _PrefsSetDouble(PREF_NAME, VAR_NAME)                            \ 
    86121{                                                                       \ 
     
    88123} 
    89124 
     125/** 
     126 * Macro to set boolean preference. 
     127 **/ 
    90128#define _PrefsSetBool(PREF_NAME, VAR_NAME)                            \ 
    91129{                                                                     \ 
     
    94132 
    95133 
    96 WX_DECLARE_STRING_HASH_MAP(Preference*, PreferencesHashMap); 
    97  
    98  
    99 /** 
    100 * This is the component which manages the configuration 
    101 * It's a singleton 
    102 **/ 
     134WX_DECLARE_STRING_HASH_MAP(Preference*, PreferencesHashMap); /**< Hashmap to store preferences */ 
     135 
     136 
     137/** 
     138 * This class manages the configuration settings. 
     139 * This class can only be instantiated once. 
     140 **/ 
    103141class PreferencesManager 
    104142{ 
    105143protected: 
    106         PreferencesHashMap         mPrefsHashMap; 
    107         static PreferencesManager *mInstance; 
    108  
     144        PreferencesHashMap         mPrefsHashMap; /**< The preference hashmap */ 
     145        static PreferencesManager *mInstance; /**< The single instance of the PreferencesManager */ 
     146 
     147        /** 
     148         * Contructor. 
     149         **/ 
    109150        PreferencesManager(void); 
     151 
     152        /** 
     153         * Destructor. 
     154         **/ 
    110155        ~PreferencesManager(void); 
    111156 
     157        /** 
     158         * Change/set the value of a preference. 
     159         * @param preference The preference to set. 
     160         **/ 
    112161        void        SetPref(Preference* preference); 
     162 
     163        /** 
     164         * Retrieve the value of a preference. 
     165         **/ 
    113166        Preference* GetPref(const wxString& name); 
    114167 
     168        /** 
     169         * Load the preferences from the disk. 
     170         **/ 
    115171        void Load(void); 
    116172 
     
    118174public: 
    119175        // Singleton pattern 
     176        /** 
     177         * Create the single instance of the PreferencesManager. 
     178         **/ 
    120179        static void CreateInstance(void); 
     180 
     181        /** 
     182         * Destroy the single instance of the PreferencesManager 
     183         **/ 
    121184        static void DestroyInstance(void); 
     185 
     186        /** 
     187         * Return the single instance of the PreferencesManager 
     188         **/ 
    122189        static PreferencesManager* GetInstance(void); 
     190 
     191        /** 
     192         * Save all the preferences to the disk. 
     193         **/ 
    123194        void Save(void); 
    124195 
    125196        // Preferences management 
    126         // All the GetXXX() methods return a boolean, indicating if the preference could be retrieve or not 
     197        // All the GetXXX() methods return a boolean, indicating if the preference could be retrieved or not 
     198        /** 
     199         * Set the value of a boolean preference. 
     200         * @param name Preference name 
     201         * @param value Value to retrieve 
     202         **/ 
    127203        void SetBool(const wxString& name, bool value) {SetPref(new Preference(name, value));} 
     204 
     205        /** 
     206         * Retrieve the value of a boolean preference. 
     207         * @param name Preference name 
     208         * @param value Value to retrieve 
     209         **/ 
    128210        bool GetBool(const wxString& name, bool& value); 
    129211 
     212        /** 
     213         * Set the value of a unsigned int preference. 
     214         * @param name Preference name 
     215         * @param value Value to retrieve 
     216         **/ 
    130217        void SetUint(const wxString& name, wxUint32 value) {SetPref(new Preference(name, value));} 
     218 
     219        /** 
     220         * Retrieve the value of an unsigned int preference. 
     221         * @param name Preference name 
     222         * @param value Value to retrieve 
     223         **/ 
    131224        bool GetUint(const wxString& name, wxUint32& value); 
    132225 
     226        /** 
     227         * Set the value of a signed int preference. 
     228         * @param name Preference name 
     229         * @param value Value to retrieve 
     230         **/ 
    133231        void SetInt(const wxString& name, wxInt32 value) {SetPref(new Preference(name, value));} 
     232 
     233        /** 
     234         * Retrieve the value of an signed int preference. 
     235         * @param name Preference name 
     236         * @param value Value to retrieve 
     237         **/ 
    134238        bool GetInt(const wxString& name, wxInt32& value); 
    135239 
     240        /** 
     241         * Set the value of a double preference. 
     242         * @param name Preference name 
     243         * @param value Value to retrieve 
     244         **/ 
    136245        void SetDouble(const wxString& name, double value) {SetPref(new Preference(name, value));} 
     246 
     247        /** 
     248         * Retrieve the value of a double preference. 
     249         * @param name Preference name 
     250         * @param value Value to retrieve 
     251         **/ 
    137252        bool GetDouble(const wxString& name, double& value); 
    138253 
     254        /** 
     255         * Set the value of a string preference. 
     256         * @param name Preference name 
     257         * @param value Value to retrieve 
     258         **/ 
    139259        void SetString(const wxString& name, const wxString& value) {SetPref(new Preference(name, value));} 
     260 
     261        /** 
     262         * Retrieve the value of a string preference. 
     263         * @param name Preference name 
     264         * @param value Value to retrieve 
     265         **/ 
    140266        bool GetString(const wxString& name, wxString& value); 
    141267 
     268        /** 
     269         * Set the value of a hidden string preference. 
     270         * @param name Preference name 
     271         * @param value Value to retrieve 
     272         **/ 
    142273        void SetHiddenString(const wxString& name, const wxString& value) {SetPref(new Preference(name, value, true));} 
     274 
     275        /** 
     276         * Retrieve the value of an hidden string preference. 
     277         * @param name Preference name 
     278         * @param value Value to retrieve 
     279         **/ 
    143280        bool GetHiddenString(const wxString& name, wxString& value); 
    144281}; 
  • branches/2.3.2beta3/src/preferencesManager.cpp

    r148 r213  
    1515*/ 
    1616 
     17/** 
     18 * \file preferencesManager.cpp 
     19 * Manages stored preferences. 
     20 * \author François Ingelrest 
     21 * \author Andrew Schofield 
     22 **/ 
     23 
    1724#include "fahmon.h" 
    1825#include "preferencesManager.h" 
     
    2936 
    3037 
    31 /** 
    32 * Constructor 
    33 **/ 
    3438PreferencesManager::PreferencesManager(void) 
    3539{ 
     
    3741 
    3842 
    39 /** 
    40 * Destructor 
    41 **/ 
    4243PreferencesManager::~PreferencesManager(void) 
    4344{ 
     
    4546 
    4647 
    47 /** 
    48 * Create the single instance of the PreferencesManager 
    49 **/ 
    5048void PreferencesManager::CreateInstance(void) 
    5149{ 
     
    5755 
    5856 
    59 /** 
    60 * Destroy the single instance of the PreferencesManager 
    61 **/ 
    6257void PreferencesManager::DestroyInstance(void) 
    6358{ 
     
    7166 
    7267 
    73 /** 
    74 * Return the single instance of the PreferencesManager 
    75 **/ 
    7668PreferencesManager* PreferencesManager::GetInstance(void) 
    7769{ 
     
    8274 
    8375 
    84 /** 
    85 * Change/set the value of a preference 
    86 **/ 
    8776void PreferencesManager::SetPref(Preference* preference) 
    8877{ 
     
    10392 
    10493 
    105 /** 
    106 * Retrieve the value of a preference 
    107 **/ 
    10894inline Preference* PreferencesManager::GetPref(const wxString& name) 
    10995{ 
     
    119105 
    120106 
    121 /** 
    122 * Retrieve the value of a boolean preference 
    123 **/ 
    124107bool PreferencesManager::GetBool(const wxString& name, bool& value) 
    125108{ 
     
    138121 
    139122 
    140 /** 
    141 * Retrieve the value of an unsigned int preference 
    142 **/ 
    143123bool PreferencesManager::GetUint(const wxString& name, wxUint32& value) 
    144124{ 
     
    157137 
    158138 
    159 /** 
    160 * Retrieve the value of an signed int preference 
    161 **/ 
    162139bool PreferencesManager::GetInt(const wxString& name, wxInt32& value) 
    163140{ 
     
    176153 
    177154 
    178 /** 
    179 * Retrieve the value of a double preference 
    180 **/ 
    181155bool PreferencesManager::GetDouble(const wxString& name, double& value) 
    182156{ 
     
    195169 
    196170 
    197 /** 
    198 * Retrieve the value of a string preference 
    199 **/ 
    200171bool PreferencesManager::GetString(const wxString& name, wxString& value) 
    201172{ 
     
    214185 
    215186 
    216 /** 
    217 * Retrieve the value of an hidden string preference 
    218 **/ 
    219187bool PreferencesManager::GetHiddenString(const wxString& name, wxString& value) 
    220188{ 
     
    233201 
    234202 
    235 /** 
    236 * Load the preferences from the disk 
    237 **/ 
    238203inline void PreferencesManager::Load(void) 
    239204{ 
     
    260225 
    261226 
    262 /** 
    263 * Save all the preferences to the disk 
    264 **/ 
    265227inline void PreferencesManager::Save(void) 
    266228{