Crazy Eddies GUI System
0.7.6
|
00001 /*********************************************************************** 00002 filename: CEGUIExceptions.h 00003 created: 20/2/2004 00004 author: Paul D Turner, Frederico Jeronimo (fjeronimo) 00005 00006 purpose: Defines exceptions used within the system 00007 *************************************************************************/ 00008 /*************************************************************************** 00009 * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining 00012 * a copy of this software and associated documentation files (the 00013 * "Software"), to deal in the Software without restriction, including 00014 * without limitation the rights to use, copy, modify, merge, publish, 00015 * distribute, sublicense, and/or sell copies of the Software, and to 00016 * permit persons to whom the Software is furnished to do so, subject to 00017 * the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be 00020 * included in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00023 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00024 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00025 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00026 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00027 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00028 * OTHER DEALINGS IN THE SOFTWARE. 00029 ***************************************************************************/ 00030 #ifndef _CEGUIExceptions_h_ 00031 #define _CEGUIExceptions_h_ 00032 00033 #include "CEGUIBase.h" 00034 #include "CEGUIString.h" 00035 #include <exception> 00036 00037 // Start of CEGUI namespace section 00038 namespace CEGUI 00039 { 00041 class CEGUIEXPORT Exception : public std::exception 00042 { 00043 public: 00045 virtual ~Exception(void) throw(); 00046 00056 const String& getMessage(void) const 00057 { return d_message; } 00058 00067 const String& getName() const 00068 { return d_name; } 00069 00079 const String& getFileName(void) const 00080 { return d_filename; } 00081 00089 int getLine(void) const 00090 { return d_line; } 00091 00092 // override from std::exception. 00093 const char* what() const throw(); 00094 00095 protected: 00116 Exception(const String& message = "", 00117 const String& name = "CEGUI::Exception", 00118 const String& filename = "", 00119 int line = 0); 00120 00122 String d_message; 00124 String d_filename; 00126 String d_name; 00128 int d_line; 00130 String d_what; 00131 }; 00132 00133 //----------------------------------------------------------------------------// 00134 00136 class CEGUIEXPORT GenericException : public Exception 00137 { 00138 public: 00160 GenericException(const String& message, 00161 const String& file = "unknown", int line = 0) : 00162 Exception(message, "CEGUI::GenericException", file, line) 00163 {} 00164 }; 00165 00183 #define GenericException(message) \ 00184 GenericException(message, __FILE__, __LINE__) 00185 00186 //----------------------------------------------------------------------------// 00187 00189 class CEGUIEXPORT UnknownObjectException : public Exception 00190 { 00191 public: 00213 UnknownObjectException(const String& message, 00214 const String& file = "unknown", int line = 0) : 00215 Exception(message, "CEGUI::UnknownObjectException", file, line) 00216 {} 00217 }; 00218 00236 #define UnknownObjectException(message) \ 00237 UnknownObjectException(message, __FILE__, __LINE__) 00238 00239 //----------------------------------------------------------------------------// 00240 00242 class CEGUIEXPORT InvalidRequestException : public Exception 00243 { 00244 public: 00266 InvalidRequestException(const String& message, 00267 const String& file = "unknown", int line = 0) : 00268 Exception(message, "CEGUI::InvalidRequestException", file, line) 00269 {} 00270 }; 00271 00289 #define InvalidRequestException(message) \ 00290 InvalidRequestException(message, __FILE__, __LINE__) 00291 00292 //----------------------------------------------------------------------------// 00293 00295 class CEGUIEXPORT FileIOException : public Exception 00296 { 00297 public: 00319 FileIOException(const String& message, 00320 const String& file = "unknown", int line = 0) : 00321 Exception(message, "CEGUI::FileIOException", file, line) 00322 {} 00323 }; 00324 00342 #define FileIOException(message) \ 00343 FileIOException(message, __FILE__, __LINE__) 00344 00345 //----------------------------------------------------------------------------// 00346 00348 class CEGUIEXPORT RendererException : public Exception 00349 { 00350 public: 00372 RendererException(const String& message, 00373 const String& file = "unknown", int line = 0) : 00374 Exception(message, "CEGUI::RendererException", file, line) 00375 {} 00376 }; 00377 00395 #define RendererException(message) \ 00396 RendererException(message, __FILE__, __LINE__) 00397 00398 //----------------------------------------------------------------------------// 00399 00406 class CEGUIEXPORT AlreadyExistsException : public Exception 00407 { 00408 public: 00430 AlreadyExistsException(const String& message, 00431 const String& file = "unknown", int line = 0) : 00432 Exception(message, "CEGUI::AlreadyExistsException", file, line) 00433 {} 00434 }; 00435 00453 #define AlreadyExistsException(message) \ 00454 AlreadyExistsException(message, __FILE__, __LINE__) 00455 00456 //----------------------------------------------------------------------------// 00457 00459 class CEGUIEXPORT MemoryException : public Exception 00460 { 00461 public: 00483 MemoryException(const String& message, 00484 const String& file = "unknown", int line = 0) : 00485 Exception(message, "CEGUI::MemoryException", file, line) 00486 {} 00487 }; 00488 00506 #define MemoryException(message) \ 00507 MemoryException(message, __FILE__, __LINE__) 00508 00509 //----------------------------------------------------------------------------// 00510 00512 class CEGUIEXPORT NullObjectException : public Exception 00513 { 00514 public: 00536 NullObjectException(const String& message, 00537 const String& file = "unknown", int line = 0) : 00538 Exception(message, "CEGUI::NullObjectException", file, line) 00539 {} 00540 }; 00541 00559 #define NullObjectException(message) \ 00560 NullObjectException(message, __FILE__, __LINE__) 00561 00562 //----------------------------------------------------------------------------// 00563 00569 class CEGUIEXPORT ObjectInUseException : public Exception 00570 { 00571 public: 00593 ObjectInUseException(const String& message, 00594 const String& file = "unknown", int line = 0) : 00595 Exception(message, "CEGUI::ObjectInUseException", file, line) 00596 {} 00597 }; 00598 00616 #define ObjectInUseException(message) \ 00617 ObjectInUseException(message, __FILE__, __LINE__) 00618 00619 //----------------------------------------------------------------------------// 00620 00622 class CEGUIEXPORT ScriptException : public Exception 00623 { 00624 public: 00646 ScriptException(const String& message, 00647 const String& file = "unknown", int line = 0) : 00648 Exception(message, "CEGUI::ScriptException", file, line) 00649 {} 00650 }; 00651 00669 #define ScriptException(message) \ 00670 ScriptException(message, __FILE__, __LINE__) 00671 00672 00673 //----------------------------------------------------------------------------// 00674 00675 } // End of CEGUI namespace section 00676 00677 00678 #endif // end of guard _CEGUIExceptions_h_