00001 #pragma once 00002 00027 #ifndef __SETTINGS_H__ 00028 #define __SETTINGS_H__ 00029 00030 // USINGS 00031 using std::string; 00032 using std::list; 00033 using std::exception; 00034 00036 class settings 00037 { 00038 // Member functions. 00039 public: 00040 static void CreateInstance(int argc, char** argv); 00041 static void DeleteInstance(void); 00042 static settings* Instance(void); 00043 void Show(void); 00044 bool GetRecursive(void); 00045 bool GetDebug(void); 00046 bool GetShowHelp(void); 00047 bool GetShowVersion(void); 00048 string GetOriginalRoute(void); 00049 string GetFileRoute(void); 00050 string GetOutFile(void); 00051 string GetLogFile(void); 00052 string GetLabel(void); 00053 string GetFormat(void); 00054 private: 00055 settings(int argc, char** argv); 00056 settings(const settings& Obj); 00057 void SetDefaults(void); 00058 void SetArguments(list<string> ArgumentsList); 00059 bool ParseArgument(list<string>::const_iterator ArgsIterator, list<string>::const_iterator ArgsIteratorEnd); 00060 void ParseArgument(char Argument); 00061 00062 // Attributes. 00063 private: 00064 bool m_Recursive; 00065 bool m_Debug; 00066 bool m_ShowHelp; 00067 bool m_ShowVersion; 00068 string m_OriginalRoute; 00069 string m_FileRoute; 00070 string m_OutFile; 00071 string m_LogFile; 00072 string m_Label; 00073 string m_Format; 00074 00075 static settings* m_pInstance; 00076 }; 00077 00078 // Settings exceptions 00083 00084 namespace except 00085 { 00087 class settings_except: public exception 00088 { 00089 // Member functions. 00090 public: 00092 settings_except(void) throw(): exception() {}; 00094 virtual ~settings_except(void) throw() {}; 00096 virtual const char *what(void) const throw()=0; 00097 }; 00098 00100 class incomplete_argument: public settings_except 00101 { 00102 // Member functions. 00103 public: 00104 incomplete_argument(const string& IncompleteArgument) throw(); 00105 virtual ~incomplete_argument(void) throw(); 00106 virtual const char *what(void) const throw(); 00107 00108 // Attributes. 00109 private: 00110 string m_IncompleteArgument; 00111 }; 00112 00114 class unknow_argument: public settings_except 00115 { 00116 // Member functions. 00117 public: 00118 unknow_argument(const string& UnknowArgument) throw(); 00119 virtual ~unknow_argument(void) throw(); 00120 virtual const char *what(void) const throw(); 00121 00122 // Attributes. 00123 private: 00124 string m_UnknowArgument; 00125 }; 00126 } 00127 00128 #endif // __SETTINGS_H__
![]() |
![]() |
![]() |