00001 #ifndef _GAMEEXCEPTION_H_ 00002 #define _GAMEEXCEPTION_H_ 00003 00004 #include <vector> 00005 #include <ostream> 00006 #include <string> 00007 #include <cstdarg> 00008 00009 enum eErrorSeverity 00010 { 00011 eMinorError = 0, 00012 eMajorError, 00013 eFatalError 00014 }; 00015 00016 class GameException 00017 { 00018 public: 00019 GameException(const eErrorSeverity &severity, const std::string &str); 00020 GameException(const eErrorSeverity &severity, const char *str, ...); 00021 00022 void Output(std::ostream &stream); 00023 static void OutputLog(std::ostream &stream); 00024 static bool HasExceptionsToReport() { return (m_sTotalErrors > 0); } 00025 00026 std::string GetDescription() { return m_str; } 00027 unsigned long GetTime() { return m_time; } 00028 eErrorSeverity GetSeverity() { return m_severity; } 00029 00030 protected: 00031 std::string ConvertSeverityToString(const eErrorSeverity &severity); 00032 std::string m_str; 00033 unsigned long m_time; 00034 eErrorSeverity m_severity; 00035 static unsigned int m_sTotalErrors; 00036 static std::vector<GameException> m_svLog; 00037 }; 00038 00039 #endif
1.5.9