CEGUIExceptions.h

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 - 2007 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 
00034 // INCLUDES
00036 
00037 #include "CEGUIBase.h"
00038 #include "CEGUIString.h"
00039 
00041 // CEGUI NAMESPACE
00043 
00044 // Start of CEGUI namespace section
00045 namespace CEGUI
00046 {
00048     // EXCEPTION
00050 
00055     class  CEGUIEXPORT Exception
00056     {
00057 
00058     public:
00059         /***********************************************************************
00060          * DESTRUCTOR
00061          **********************************************************************/
00066         virtual ~Exception(void);
00067 
00068         /***********************************************************************
00069          * PUBLIC FUNCTIONS
00070          **********************************************************************/
00071 
00079         const String&   getMessage(void) const          {return d_message;}
00080 
00088         const String& getName() const { return d_name; }
00089 
00097         const String&   getFileName(void) const         {return d_filename;}
00098 
00106         const int       getLine(void) const             {return d_line;}
00107 
00108     protected:
00109 
00110         /***********************************************************************
00111          * CONSTRUCTORS
00112          **********************************************************************/
00113 
00131         Exception(const String& message = "", const String& name ="CEGUI::Exception", const String& filename = "", int line = 0);
00132 
00133         /***********************************************************************
00134          * PROTECTED VARIABLES
00135          **********************************************************************/
00136 
00141         String  d_message;
00142 
00147         String d_filename;
00148 
00153         String d_name;
00154 
00159         int d_line;
00160     };
00161 
00163     // GENERIC EXCEPTION
00165 
00170     class CEGUIEXPORT GenericException : public Exception
00171     {
00172     public:
00173 
00174         /***********************************************************************
00175          * CONSTRUCTORS/DESTRUCTORS
00176          **********************************************************************/
00177 
00196         GenericException(const String& message, const String& file = "unknown", int line = 0)
00197             : Exception(message, "CEGUI::GenericException", file, line) {}
00198     };
00199 
00216     #define GenericException(message)  \
00217         GenericException(message, __FILE__, __LINE__)
00218 
00220     // UNKNOWN OBJECT EXCEPTION
00222 
00227     class CEGUIEXPORT UnknownObjectException : public Exception
00228     {
00229     public:
00230 
00231         /***********************************************************************
00232          * CONSTRUCTORS/DESTRUCTORS
00233          **********************************************************************/
00234 
00253         UnknownObjectException(const String& message, const String& file = "unknown", int line = 0)
00254             : Exception(message, "CEGUI::UnknownObjectException", file, line) {}
00255     };
00256 
00273     #define UnknownObjectException(message)  \
00274         UnknownObjectException(message, __FILE__, __LINE__)
00275 
00277     // INVALID REQUEST EXCEPTION
00279 
00284     class CEGUIEXPORT InvalidRequestException : public Exception
00285     {
00286     public:
00287 
00288         /***********************************************************************
00289          * CONSTRUCTORS/DESTRUCTORS
00290          **********************************************************************/
00291 
00310         InvalidRequestException(const String& message, const String& file = "unknown", int line = 0)
00311             : Exception(message, "CEGUI::InvalidRequestException", file, line) {}
00312     };
00313 
00330     #define InvalidRequestException(message)  \
00331         InvalidRequestException(message, __FILE__, __LINE__)
00332 
00334     // FILE IO EXCEPTION
00336 
00341     class CEGUIEXPORT FileIOException : public Exception
00342     {
00343     public:
00344 
00345         /***********************************************************************
00346          * CONSTRUCTORS/DESTRUCTORS
00347          **********************************************************************/
00348 
00367         FileIOException(const String& message, const String& file = "unknown", int line = 0)
00368             : Exception(message, "CEGUI::FileIOException", file, line) {}
00369     };
00370 
00387     #define FileIOException(message)  \
00388         FileIOException(message, __FILE__, __LINE__)
00389 
00391     // RENDERER EXCEPTION
00393 
00398     class CEGUIEXPORT RendererException : public Exception
00399     {
00400     public:
00401 
00402         /***********************************************************************
00403          * CONSTRUCTORS/DESTRUCTORS
00404          **********************************************************************/
00405 
00424         RendererException(const String& message, const String& file = "unknown", int line = 0)
00425             : Exception(message, "CEGUI::RendererException", file, line) {}
00426     };
00427 
00444     #define RendererException(message)  \
00445         RendererException(message, __FILE__, __LINE__)
00446 
00448     // ALREADY EXISTS EXCEPTION
00450 
00455     class CEGUIEXPORT AlreadyExistsException : public Exception
00456     {
00457     public:
00458 
00459         /***********************************************************************
00460          * CONSTRUCTORS/DESTRUCTORS
00461          **********************************************************************/
00462 
00481         AlreadyExistsException(const String& message, const String& file = "unknown", int line = 0)
00482             : Exception(message, "CEGUI::AlreadyExistsException", file, line) {}
00483     };
00484 
00501     #define AlreadyExistsException(message)  \
00502         AlreadyExistsException(message, __FILE__, __LINE__)
00503 
00505     // MEMORY EXCEPTION
00507 
00512     class CEGUIEXPORT MemoryException : public Exception
00513     {
00514     public:
00515 
00516         /***********************************************************************
00517          * CONSTRUCTORS/DESTRUCTORS
00518          **********************************************************************/
00519 
00538         MemoryException(const String& message, const String& file = "unknown", int line = 0)
00539             : Exception(message, "CEGUI::MemoryException", file, line) {}
00540     };
00541 
00558     #define MemoryException(message)  \
00559         MemoryException(message, __FILE__, __LINE__)
00560 
00562     // NULL OBJECT EXCEPTION
00564 
00569     class CEGUIEXPORT NullObjectException : public Exception
00570     {
00571     public:
00572 
00573         /***********************************************************************
00574          * CONSTRUCTORS/DESTRUCTORS
00575          **********************************************************************/
00576 
00595         NullObjectException(const String& message, const String& file = "unknown", int line = 0)
00596             : Exception(message, "CEGUI::NullObjectException", file, line) {}
00597     };
00598 
00615     #define NullObjectException(message)  \
00616         NullObjectException(message, __FILE__, __LINE__)
00617 
00619     // OBJECT IN USE EXCEPTION
00621 
00626     class CEGUIEXPORT ObjectInUseException : public Exception
00627     {
00628     public:
00629 
00630         /***********************************************************************
00631          * CONSTRUCTORS/DESTRUCTORS
00632          **********************************************************************/
00633 
00652         ObjectInUseException(const String& message, const String& file = "unknown", int line = 0)
00653             : Exception(message, "CEGUI::ObjectInUseException", file, line) {}
00654     };
00655 
00672     #define ObjectInUseException(message)  \
00673         ObjectInUseException(message, __FILE__, __LINE__)
00674 
00676     // SCRIPT EXCEPTION
00678 
00683     class CEGUIEXPORT ScriptException : public Exception
00684     {
00685     public:
00686 
00687         /***********************************************************************
00688          * CONSTRUCTORS/DESTRUCTORS
00689          **********************************************************************/
00690 
00709         ScriptException(const String& message, const String& file = "unknown", int line = 0)
00710             : Exception(message, "CEGUI::ScriptException", file, line) {}
00711     };
00712 
00729     #define ScriptException(message)  \
00730         ScriptException(message, __FILE__, __LINE__)
00731 
00732 
00733 } // End of  CEGUI namespace section
00734 
00735 
00736 #endif  // end of guard _CEGUIExceptions_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4