Changeset 1660 for code/branches/gui/src/core/Exception.h
- Timestamp:
- Aug 17, 2008, 7:27:36 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/Exception.h
r1652 r1660 43 43 #include "core/Debug.h" 44 44 45 // Define some ugly macros to make things more clear 46 #define CREATE_ORXONOX_EXCEPTION(name) typedef SpecificException<Exception::name> name##Exception; 47 #define RETURN_EXCEPTION_CODE(name) \ 48 case Exception::name: \ 49 return #name; 50 51 45 52 namespace orxonox 46 53 { … … 54 61 PluginsNotFound, 55 62 InitialisationFailed, 56 NotImplemented 63 NotImplemented, 64 GameState 57 65 }; 58 66 … … 106 114 std::string getTypeName() const 107 115 { 108 // note: break is not necessary due to the return . Keep in mind!116 // note: break is not necessary due to the return in the macros. 109 117 switch (Type) 110 118 { 111 case Exception::General: 112 return "General"; 113 case Exception::FileNotFound: 114 return "FileNotFound"; 115 case Exception::PluginsNotFound: 116 return "PluginsNotFound"; 117 case Exception::InitialisationFailed: 118 return "InitialisationFailed"; 119 case Exception::NotImplemented: 120 return "NotImplemented"; 119 RETURN_EXCEPTION_CODE(General) 120 RETURN_EXCEPTION_CODE(FileNotFound); 121 RETURN_EXCEPTION_CODE(PluginsNotFound); 122 RETURN_EXCEPTION_CODE(InitialisationFailed); 123 RETURN_EXCEPTION_CODE(NotImplemented); 124 RETURN_EXCEPTION_CODE(GameState); 121 125 default: 122 126 return ""; … … 125 129 }; 126 130 127 typedef SpecificException<Exception::General> GeneralException; 128 typedef SpecificException<Exception::FileNotFound> FileNotFoundException; 129 typedef SpecificException<Exception::PluginsNotFound> PluginsNotFoundException; 130 typedef SpecificException<Exception::InitialisationFailed> InitialisationFailedException; 131 typedef SpecificException<Exception::NotImplemented> NotImplementedException; 131 // define the template spcialisations 132 CREATE_ORXONOX_EXCEPTION(General); 133 CREATE_ORXONOX_EXCEPTION(FileNotFound); 134 CREATE_ORXONOX_EXCEPTION(PluginsNotFound); 135 CREATE_ORXONOX_EXCEPTION(InitialisationFailed); 136 CREATE_ORXONOX_EXCEPTION(NotImplemented); 137 CREATE_ORXONOX_EXCEPTION(GameState); 132 138 133 139 #define ThrowException(type, description) \
Note: See TracChangeset
for help on using the changeset viewer.