00001 00002 // 00003 // settings 00004 // 00005 // Copyright (c) 2004 Bioware Copr. 00006 // 00007 // The source code included in this file is confidential, 00008 // secret, or propietary information of Bioware Corp. It 00009 // may not be used in whole or in part without express 00010 // written permission from Bioware Corp. 00011 // 00013 // 00017 // 00019 // 00020 // Created On: 9:12:2008 11:39 00021 // 00023 00024 #ifndef _OPTIONS_H 00025 #define _OPTIONS_H 00026 00027 00029 // 00034 // 00059 // 00060 // 00062 class Settings 00063 { 00064 public: 00065 00067 Settings(); 00068 00074 Settings( int a_nArgCount, char* a_pArgValues [] ); 00075 00077 ~Settings(); 00078 00079 // ------------------------------------------------------------------------- 00080 // Enumerators 00081 // ------------------------------------------------------------------------- 00082 00087 enum eBooleanSetting 00088 { 00089 Setting_Output_Verbose, 00090 Setting_Python_OutputToFile, 00091 // ... 00092 00093 Setting_Invalid 00094 }; 00095 00100 enum eStringSetting 00101 { 00102 Setting_ProgramName, 00103 Setting_MainScript, 00104 Setting_PluginDir 00105 // ... 00106 }; 00107 00112 enum eNumericSetting 00113 { 00114 Setting_ErrorHeapSize, 00115 Setting_CPUCores 00116 // ... 00117 }; 00118 00119 // ------------------------------------------------------------------------- 00120 // Configuration 00121 // ------------------------------------------------------------------------- 00122 00133 void Parse( int a_nArgCount, char* a_pArgValues [] ); 00134 00135 00136 // ------------------------------------------------------------------------- 00137 // Utilities 00138 // ------------------------------------------------------------------------- 00139 00145 void Set( eBooleanSetting a_nSetting, bool a_bValue ); 00146 00152 bool Get( eBooleanSetting a_nSetting ); 00153 00158 char* Get( eStringSetting a_nSetting ); 00159 00164 int Get( eNumericSetting a_nSetting ); 00165 00170 inline bool CanContinue(){ return m_bCanContinue; } 00171 00175 void PrintSettingsHelp(); 00176 00183 static void SetGlobalSettings( Settings* a_pSettings ){ m_pGlobalSettings = a_pSettings; } 00184 00192 static Settings* GetGlobalSettings(){ return m_pGlobalSettings; } 00193 00194 00195 private: 00196 00197 // Loads default settings 00198 void LoadDefaults(); 00199 00200 // Parses the provided string and returns an enumerated setting 00201 eBooleanSetting GetSettingFromString( char* a_sSetting ); 00202 00203 00204 bool m_booleanSettings[ Setting_Invalid ]; 00205 char* m_sScriptName; 00206 char* m_sPluginDir; 00207 char* m_sAppName; 00208 bool m_bCanContinue; 00209 static Settings* m_pGlobalSettings; 00210 00211 }; 00212 00213 00214 00215 00216 #endif