Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/levelElias/src/external/ois/OISException.h @ 10158

Last change on this file since 10158 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1/*
2The zlib/libpng License
3
4Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
5
6This software is provided 'as-is', without any express or implied warranty. In no event will
7the authors be held liable for any damages arising from the use of this software.
8
9Permission is granted to anyone to use this software for any purpose, including commercial
10applications, and to alter it and redistribute it freely, subject to the following
11restrictions:
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
28namespace OIS
29{
30        //! Simple enum's for dealing with exceptions
31    enum OIS_ERROR
32        {
33                E_InputDisconnected,
34                E_InputDeviceNonExistant,
35                E_InputDeviceNotSupported,
36                E_DeviceFull,
37                E_NotSupported,
38                E_NotImplemented,
39                E_Duplicate,
40                E_InvalidParam,
41                E_General
42        };
43
44        /**
45        @remarks
46                Class for handling OIS exceptions. Much cleaner than checking every method for reurn value.
47                Inherits from std::exception so you can simply log those messages if you want to be generic.
48                Also note that this has a source file now since OSX was not finding the OIS::Exception symbol
49                which would cause program abortion with now correponding exception type.
50        */
51        class _OISExport Exception : public std::exception
52        {
53                //! Hidden default
54                Exception() : eType(E_General), eLine(0), eFile(0) {}
55        public:
56                //! Creates exception object
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
64                //! The type of exception raised
65                const OIS_ERROR eType;
66                //! The line number it occurred on
67                const int eLine;
68                //! The source file
69                const char* eFile;
70                //! A message passed along when the exception was raised
71                const char* eText;
72        };
73}
74
75//! Use this macro to handle exceptions easily
76#define OIS_EXCEPT( err, str ) throw( OIS::Exception(err, str, __LINE__, __FILE__) )
77
78#endif //_OIS_EXCEPTION_HEADER_
Note: See TracBrowser for help on using the repository browser.