#include <prefs.h>
Inheritance diagram for Preferences:
Public Member Functions | |
Preferences () | |
Initialises the section caching system. | |
~Preferences () | |
Deletes all PreferenceSection objects used by this object. | |
BOOL | Init () |
This initialises the Preferences object. This includes setting up a link to the OIL and opening the preference file for reading. | |
void | Deinit () |
This de-initialises the Preferences object. This includes closing down whatever OIL mechanisms were set up by Init(). | |
void | Write () |
This writes out all Camelot preferences to the application's preference file, using the OIL. | |
void | WipePreferenceFile () |
Used to remove an old (possibly incompatible) preference file. It assumes that the preference system has been initialised and that it is still active (i.e. Deinit() has not been called). | |
void | WipeDangerousPrefs () |
Used to remove any dangerous sections from the registry, when upgrading from an old version. | |
BOOL | DeclareSection (TCHAR *Section, UINT32 InitialSize) |
BOOL | DeclarePref (TCHAR *Section, TCHAR *Pref, INT32 *PrefVar, INT32 Min=INT_MIN, INT32 Max=INT_MAX) |
BOOL | DeclarePref (TCHAR *Section, TCHAR *Pref, UINT32 *PrefVar, UINT32 Min=0, UINT32 Max=UINT_MAX) |
BOOL | DeclarePref (TCHAR *Section, TCHAR *Pref, double *PrefVar, double Min=DBL_MIN, double Max=DBL_MAX) |
BOOL | DeclarePref (TCHAR *Section, TCHAR *Pref, StringBase *PrefVar) |
BOOL | GetPrefValue (TCHAR *Section, TCHAR *Pref, INT32 *PrefVar) |
BOOL | GetPrefValue (TCHAR *Section, TCHAR *Pref, UINT32 *PrefVar) |
BOOL | GetPrefValue (TCHAR *Section, TCHAR *Pref, double *PrefVar) |
BOOL | SetPrefValue (TCHAR *Section, TCHAR *Pref, INT32 *PrefVar) |
BOOL | SetPrefValue (TCHAR *Section, TCHAR *Pref, UINT32 *PrefVar) |
BOOL | SetPrefValue (TCHAR *Section, TCHAR *Pref, double *PrefVar) |
BOOL | SetPrefDirect (TCHAR *Section, TCHAR *Pref, const TCHAR *pValue, BOOL Force=FALSE) |
BOOL | SetPrefDirect (TCHAR *Section, TCHAR *Pref, PreferenceType Type, PrefData Data) |
BOOL | SetPrefDirect (TCHAR *Section, TCHAR *Pref, INT32 *pValue) |
BOOL | SetPrefDirect (TCHAR *Section, TCHAR *Pref, UINT32 *pValue) |
BOOL | SetPrefDirect (TCHAR *Section, TCHAR *Pref, double *pValue) |
BOOL | GetPrefDirect (TCHAR *Section, TCHAR *Pref, StringBase *pValue) |
BOOL | GetPrefDirect (TCHAR *Section, TCHAR *Pref, PreferenceType Type, PrefData Data) |
BOOL | GetPrefDirect (TCHAR *Section, TCHAR *Pref, INT32 *pValue) |
BOOL | GetPrefDirect (TCHAR *Section, TCHAR *Pref, UINT32 *pValue) |
BOOL | GetPrefDirect (TCHAR *Section, TCHAR *Pref, double *pValue) |
Private Member Functions | |
PreferenceSection * | GetSection (TCHAR *SectionName) |
Private Attributes | |
PreferenceSection * | CurrentSection |
OILPreferences * | OILPrefs |
When the application wants to save the preferences, the Write() function of this class should be used.
Definition at line 151 of file prefs.h.
|
Initialises the section caching system.
Definition at line 880 of file prefs.cpp. 00881 { 00882 CurrentSection = NULL; 00883 OILPrefs = NULL; 00884 }
|
|
Deletes all PreferenceSection objects used by this object.
Definition at line 901 of file prefs.cpp. 00902 { 00903 #if !defined(EXCLUDE_FROM_RALPH) 00904 // Close the preferences file 00905 if (OILPrefs != NULL) 00906 { 00907 OILPrefs->CloseInput(); 00908 delete OILPrefs; 00909 } 00910 00911 PreferenceSection *pSection; 00912 00913 // Delete all the sections for this preferences object 00914 do 00915 { 00916 // Unlink the first item from the list 00917 pSection = (PreferenceSection *) this->RemoveHead(); 00918 00919 // It doesn't matter if pSection is NULL - delete handles it 00920 delete pSection; 00921 00922 } while (pSection != NULL); 00923 #endif 00924 }
|
|
|
|
|
|
|
|
|
|
|
|
This de-initialises the Preferences object. This includes closing down whatever OIL mechanisms were set up by Init().
Definition at line 1025 of file prefs.cpp. 01026 { 01027 #if !defined(EXCLUDE_FROM_RALPH) 01028 // Close the preferences file 01029 if (OILPrefs != NULL) 01030 OILPrefs->CloseInput(); 01031 #endif 01032 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This initialises the Preferences object. This includes setting up a link to the OIL and opening the preference file for reading.
Reimplemented from SimpleCCObject. Definition at line 986 of file prefs.cpp. 00987 { 00988 #if !defined(EXCLUDE_FROM_RALPH) 00989 // Create a link to the OIL 00990 OILPrefs = OILPreferences::Init(); 00991 00992 // Flag error if it failed 00993 if (OILPrefs == NULL) 00994 return FALSE; 00995 00996 PrefsInitedOk = TRUE; 00997 00998 // Initialise the preference file for reading 00999 return OILPrefs->OpenInput(); 01000 01001 #else //EXCLUDE_FROM_RALPH 01002 // Be gone you pesky prefs system :-) 01003 OILPrefs = NULL; 01004 PrefsInitedOk = FALSE; 01005 return TRUE; 01006 #endif //EXCLUDE_FROM_RALPH 01007 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Used to remove any dangerous sections from the registry, when upgrading from an old version.
Definition at line 1072 of file prefs.cpp. 01073 { 01074 #if !defined(EXCLUDE_FROM_RALPH) 01075 ENSURE(OILPrefs != NULL, "OILPreferences system not initialised"); 01076 01077 OILPrefs->WipeDangerousPrefs(); 01078 #endif 01079 }
|
|
Used to remove an old (possibly incompatible) preference file. It assumes that the preference system has been initialised and that it is still active (i.e. Deinit() has not been called).
Definition at line 1048 of file prefs.cpp. 01049 { 01050 #if !defined(EXCLUDE_FROM_RALPH) 01051 ENSURE(OILPrefs != NULL, "OILPreferences system not initialised"); 01052 01053 // Close the file, clear it, and re-open it 01054 OILPrefs->CloseInput(); 01055 OILPrefs->WipePreferenceFile(); 01056 OILPrefs->OpenInput(); 01057 #endif 01058 }
|
|
This writes out all Camelot preferences to the application's preference file, using the OIL.
Definition at line 943 of file prefs.cpp. 00944 { 00945 #if !defined(EXCLUDE_FROM_RALPH) 00946 // First check if there is a valid OILPrefs, as if there was a problem on start up such as 00947 // the MSCVRTn.DLL failing to load then the preferences may have been not fully set up. 00948 // Static variable used as the class may not have been created! 00949 if (PrefsInitedOk && (OILPrefs != NULL)) 00950 { 00951 // Perform any preparation necessary to start writing preferences 00952 OILPrefs->OpenOutput(); 00953 00954 // Write out all the sections for this preferences object 00955 PreferenceSection *pSection = (PreferenceSection *) this->GetHead(); 00956 00957 while (pSection != NULL) 00958 { 00959 // Write out this section and move on to the next 00960 pSection->Write(OILPrefs); 00961 pSection = (PreferenceSection *) this->GetNext(pSection); 00962 } 00963 00964 // Perform any platform-deppy clean-up required after writing the preferences 00965 OILPrefs->CloseOutput(); 00966 } 00967 #endif 00968 }
|
|
|
|
|