Crazy Eddies GUI System  0.6.0
CEGUIExceptions.h
1 /***********************************************************************
2 filename: CEGUIExceptions.h
3 created: 20/2/2004
4 author: Paul D Turner, Frederico Jeronimo (fjeronimo)
5 
6 purpose: Defines exceptions used within the system
7 *************************************************************************/
8 /***************************************************************************
9 * Copyright (C) 2004 - 2007 Paul D Turner & The CEGUI Development Team
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining
12 * a copy of this software and associated documentation files (the
13 * "Software"), to deal in the Software without restriction, including
14 * without limitation the rights to use, copy, modify, merge, publish,
15 * distribute, sublicense, and/or sell copies of the Software, and to
16 * permit persons to whom the Software is furnished to do so, subject to
17 * the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be
20 * included in all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 ***************************************************************************/
30 #ifndef _CEGUIExceptions_h_
31 #define _CEGUIExceptions_h_
32 
34 // INCLUDES
36 
37 #include "CEGUIBase.h"
38 #include "CEGUIString.h"
39 
41 // CEGUI NAMESPACE
43 
44 // Start of CEGUI namespace section
45 namespace CEGUI
46 {
48  // EXCEPTION
50 
55  class CEGUIEXPORT Exception
56  {
57 
58  public:
59  /************************************************************************/
60  /* DESTRUCTOR
61  /************************************************************************/
66  virtual ~Exception(void);
67 
68  /************************************************************************/
69  /* PUBLIC FUNCTIONS
70  /************************************************************************/
71 
79  const String& getMessage(void) const {return d_message;}
80 
88  const String& getName() const { return d_name; }
89 
97  const String& getFileName(void) const {return d_filename;}
98 
106  const int getLine(void) const {return d_line;}
107 
108  protected:
109 
110  /************************************************************************/
111  /* CONSTRUCTORS
112  /************************************************************************/
113 
131  Exception(const String& message = "", const String& name ="CEGUI::Exception", const String& filename = "", int line = 0);
132 
133  /************************************************************************/
134  /* PROTECTED VARIABLES
135  /************************************************************************/
136 
142 
148 
154 
159  int d_line;
160  };
161 
163  // GENERIC EXCEPTION
165 
170  class CEGUIEXPORT GenericException : public Exception
171  {
172  public:
173 
174  /************************************************************************/
175  /* CONSTRUCTORS/DESTRUCTORS
176  /************************************************************************/
177 
196  GenericException(const String& message, const String& file = "unknown", int line = 0)
197  : Exception(message, "CEGUI::GenericException", file, line) {}
198  };
199 
216  #define GenericException(message) \
217  GenericException(message, __FILE__, __LINE__)
218 
220  // UNKNOWN OBJECT EXCEPTION
222 
227  class CEGUIEXPORT UnknownObjectException : public Exception
228  {
229  public:
230 
231  /************************************************************************/
232  /* CONSTRUCTORS/DESTRUCTORS
233  /************************************************************************/
234 
253  UnknownObjectException(const String& message, const String& file = "unknown", int line = 0)
254  : Exception(message, "CEGUI::UnknownObjectException", file, line) {}
255  };
256 
273  #define UnknownObjectException(message) \
274  UnknownObjectException(message, __FILE__, __LINE__)
275 
277  // INVALID REQUEST EXCEPTION
279 
284  class CEGUIEXPORT InvalidRequestException : public Exception
285  {
286  public:
287 
288  /************************************************************************/
289  /* CONSTRUCTORS/DESTRUCTORS
290  /************************************************************************/
291 
310  InvalidRequestException(const String& message, const String& file = "unknown", int line = 0)
311  : Exception(message, "CEGUI::InvalidRequestException", file, line) {}
312  };
313 
330  #define InvalidRequestException(message) \
331  InvalidRequestException(message, __FILE__, __LINE__)
332 
334  // FILE IO EXCEPTION
336 
341  class CEGUIEXPORT FileIOException : public Exception
342  {
343  public:
344 
345  /************************************************************************/
346  /* CONSTRUCTORS/DESTRUCTORS
347  /************************************************************************/
348 
367  FileIOException(const String& message, const String& file = "unknown", int line = 0)
368  : Exception(message, "CEGUI::FileIOException", file, line) {}
369  };
370 
387  #define FileIOException(message) \
388  FileIOException(message, __FILE__, __LINE__)
389 
391  // RENDERER EXCEPTION
393 
398  class CEGUIEXPORT RendererException : public Exception
399  {
400  public:
401 
402  /************************************************************************/
403  /* CONSTRUCTORS/DESTRUCTORS
404  /************************************************************************/
405 
424  RendererException(const String& message, const String& file = "unknown", int line = 0)
425  : Exception(message, "CEGUI::RendererException", file, line) {}
426  };
427 
444  #define RendererException(message) \
445  RendererException(message, __FILE__, __LINE__)
446 
448  // ALREADY EXISTS EXCEPTION
450 
455  class CEGUIEXPORT AlreadyExistsException : public Exception
456  {
457  public:
458 
459  /************************************************************************/
460  /* CONSTRUCTORS/DESTRUCTORS
461  /************************************************************************/
462 
481  AlreadyExistsException(const String& message, const String& file = "unknown", int line = 0)
482  : Exception(message, "CEGUI::AlreadyExistsException", file, line) {}
483  };
484 
501  #define AlreadyExistsException(message) \
502  AlreadyExistsException(message, __FILE__, __LINE__)
503 
505  // MEMORY EXCEPTION
507 
512  class CEGUIEXPORT MemoryException : public Exception
513  {
514  public:
515 
516  /************************************************************************/
517  /* CONSTRUCTORS/DESTRUCTORS
518  /************************************************************************/
519 
538  MemoryException(const String& message, const String& file = "unknown", int line = 0)
539  : Exception(message, "CEGUI::MemoryException", file, line) {}
540  };
541 
558  #define MemoryException(message) \
559  MemoryException(message, __FILE__, __LINE__)
560 
562  // NULL OBJECT EXCEPTION
564 
569  class CEGUIEXPORT NullObjectException : public Exception
570  {
571  public:
572 
573  /************************************************************************/
574  /* CONSTRUCTORS/DESTRUCTORS
575  /************************************************************************/
576 
595  NullObjectException(const String& message, const String& file = "unknown", int line = 0)
596  : Exception(message, "CEGUI::NullObjectException", file, line) {}
597  };
598 
615  #define NullObjectException(message) \
616  NullObjectException(message, __FILE__, __LINE__)
617 
619  // OBJECT IN USE EXCEPTION
621 
626  class CEGUIEXPORT ObjectInUseException : public Exception
627  {
628  public:
629 
630  /************************************************************************/
631  /* CONSTRUCTORS/DESTRUCTORS
632  /************************************************************************/
633 
652  ObjectInUseException(const String& message, const String& file = "unknown", int line = 0)
653  : Exception(message, "CEGUI::ObjectInUseException", file, line) {}
654  };
655 
672  #define ObjectInUseException(message) \
673  ObjectInUseException(message, __FILE__, __LINE__)
674 
676  // SCRIPT EXCEPTION
678 
683  class CEGUIEXPORT ScriptException : public Exception
684  {
685  public:
686 
687  /************************************************************************/
688  /* CONSTRUCTORS/DESTRUCTORS
689  /************************************************************************/
690 
709  ScriptException(const String& message, const String& file = "unknown", int line = 0)
710  : Exception(message, "CEGUI::ScriptException", file, line) {}
711  };
712 
729  #define ScriptException(message) \
730  ScriptException(message, __FILE__, __LINE__)
731 
732 
733 } // End of CEGUI namespace section
734 
735 
736 #endif // end of guard _CEGUIExceptions_h_