Orxonox  0.0.5 Codename: Arcturus
OISException.h
Go to the documentation of this file.
1 /*
2 The zlib/libpng License
3 
4 Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
5 
6 This software is provided 'as-is', without any express or implied warranty. In no event will
7 the authors be held liable for any damages arising from the use of this software.
8 
9 Permission is granted to anyone to use this software for any purpose, including commercial
10 applications, and to alter it and redistribute it freely, subject to the following
11 restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not claim that
14  you wrote the original software. If you use this software in a product,
15  an acknowledgment in the product documentation would be appreciated but is
16  not required.
17 
18  2. Altered source versions must be plainly marked as such, and must not be
19  misrepresented as being the original software.
20 
21  3. This notice may not be removed or altered from any source distribution.
22 */
23 #ifndef _OIS_EXCEPTION_HEADER_
24 #define _OIS_EXCEPTION_HEADER_
25 #include "OISPrereqs.h"
26 #include <exception>
27 
28 namespace OIS
29 {
31  enum OIS_ERROR
32  {
42  };
43 
51  class _OISExport Exception : public std::exception
52  {
54  Exception() : eType(E_General), eLine(0), eFile(0) {}
55  public:
57  Exception( OIS_ERROR err, const char* str, int line, const char *file )
58  : eType(err), eLine(line), eFile(file), eText(str) {}
59 
60  ~Exception() throw() {}
61 
62  virtual const char* what() const throw();
63 
67  const int eLine;
69  const char* eFile;
71  const char* eText;
72  };
73 }
74 
76 #define OIS_EXCEPT( err, str ) throw( OIS::Exception(err, str, __LINE__, __FILE__) )
77 
78 #endif //_OIS_EXCEPTION_HEADER_
#define _OISExport
Definition: OISPrereqs.h:40
Definition: OISException.h:37
const OIS_ERROR eType
The type of exception raised.
Definition: OISException.h:65
Exception(OIS_ERROR err, const char *str, int line, const char *file)
Creates exception object.
Definition: OISException.h:57
Exception()
Hidden default.
Definition: OISException.h:54
Definition: OISException.h:36
const char * eFile
The source file.
Definition: OISException.h:69
Definition: OISException.h:51
Definition: OISException.h:41
Definition: OISException.h:38
OIS_ERROR
Simple enum&#39;s for dealing with exceptions.
Definition: OISException.h:31
~Exception()
Definition: OISException.h:60
Definition: OISException.h:33
const int eLine
The line number it occurred on.
Definition: OISException.h:67
Definition: OISException.h:34
Definition: EventHelpers.h:31
Definition: OISException.h:40
Definition: OISException.h:35
Definition: OISException.h:39
const char * eText
A message passed along when the exception was raised.
Definition: OISException.h:71