~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/Exception.h

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-02 03:28:11 UTC
  • Revision ID: neil.patel@canonical.com-20100902032811-i2m18tfb6pkasnvt
Remove Win EOL chars

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
 
23
 
#ifndef EXCEPTION_H
24
 
#define EXCEPTION_H
25
 
 
26
 
#include <string>
27
 
 
28
 
NAMESPACE_BEGIN
29
 
 
30
 
// *****************
31
 
// *               *
32
 
// *  Exception  *
33
 
// *               *
34
 
// *****************
35
 
//
36
 
// The exception handling classes from the STL do what we want,
37
 
// so this is nothing more than a base class for any of our 
38
 
// derived exceptions. I have changed the constructor to take a
39
 
// std::string object, but this gets converted before calling
40
 
// std::exception.
41
 
 
42
 
 
43
 
class Exception : public std::exception
44
 
{
45
 
public:
46
 
    Exception (std::string name) throw()
47
 
        : std::exception (), name_ (name) 
48
 
    {
49
 
    }
50
 
 
51
 
    virtual ~Exception () throw () {}
52
 
 
53
 
    virtual const char* what () const throw()
54
 
    { 
55
 
        return name_.c_str();
56
 
    }
57
 
 
58
 
protected:
59
 
    std::string name_;
60
 
};
61
 
 
62
 
 
63
 
// ************************
64
 
// *                      *
65
 
// *  Derived Exceptions  *
66
 
// *                      *
67
 
// ************************
68
 
 
69
 
class BoundsException : public Exception
70
 
{
71
 
public:
72
 
    BoundsException (std::string name="") 
73
 
        : Exception ("apBoundsException: " + name) 
74
 
    {
75
 
    }
76
 
};
77
 
 
78
 
class NotSupportedException : public Exception
79
 
{
80
 
public:
81
 
    NotSupportedException (std::string name="")
82
 
        : Exception ("NotSupportedException: " + name) 
83
 
    {
84
 
    }
85
 
};
86
 
 
87
 
class DivisionByZeroException : public Exception
88
 
{
89
 
public:
90
 
    DivisionByZeroException (std::string name="")
91
 
        : Exception ("DivisionByZeroException: " + name) 
92
 
    {
93
 
    }
94
 
};
95
 
 
96
 
class InvalidIndexException : public Exception
97
 
{
98
 
public:
99
 
    InvalidIndexException (std::string name="")
100
 
        : Exception ("InvalidIndexException: " + name) 
101
 
    {
102
 
    }
103
 
};
104
 
 
105
 
NAMESPACE_END
106
 
 
 
23
#ifndef EXCEPTION_H
 
24
#define EXCEPTION_H
 
25
 
 
26
#include <string>
 
27
 
 
28
NAMESPACE_BEGIN
 
29
 
 
30
// *****************
 
31
// *               *
 
32
// *  Exception  *
 
33
// *               *
 
34
// *****************
 
35
//
 
36
// The exception handling classes from the STL do what we want,
 
37
// so this is nothing more than a base class for any of our 
 
38
// derived exceptions. I have changed the constructor to take a
 
39
// std::string object, but this gets converted before calling
 
40
// std::exception.
 
41
 
 
42
 
 
43
class Exception : public std::exception
 
44
{
 
45
public:
 
46
    Exception (std::string name) throw()
 
47
        : std::exception (), name_ (name) 
 
48
    {
 
49
    }
 
50
 
 
51
    virtual ~Exception () throw () {}
 
52
 
 
53
    virtual const char* what () const throw()
 
54
    { 
 
55
        return name_.c_str();
 
56
    }
 
57
 
 
58
protected:
 
59
    std::string name_;
 
60
};
 
61
 
 
62
 
 
63
// ************************
 
64
// *                      *
 
65
// *  Derived Exceptions  *
 
66
// *                      *
 
67
// ************************
 
68
 
 
69
class BoundsException : public Exception
 
70
{
 
71
public:
 
72
    BoundsException (std::string name="") 
 
73
        : Exception ("apBoundsException: " + name) 
 
74
    {
 
75
    }
 
76
};
 
77
 
 
78
class NotSupportedException : public Exception
 
79
{
 
80
public:
 
81
    NotSupportedException (std::string name="")
 
82
        : Exception ("NotSupportedException: " + name) 
 
83
    {
 
84
    }
 
85
};
 
86
 
 
87
class DivisionByZeroException : public Exception
 
88
{
 
89
public:
 
90
    DivisionByZeroException (std::string name="")
 
91
        : Exception ("DivisionByZeroException: " + name) 
 
92
    {
 
93
    }
 
94
};
 
95
 
 
96
class InvalidIndexException : public Exception
 
97
{
 
98
public:
 
99
    InvalidIndexException (std::string name="")
 
100
        : Exception ("InvalidIndexException: " + name) 
 
101
    {
 
102
    }
 
103
};
 
104
 
 
105
NAMESPACE_END
 
106
 
107
107
#endif // EXCEPTION_H
 
 
b'\\ No newline at end of file'