OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [language/] [cxx/] [ustl/] [current/] [include/] [ustl/] [ustdxept.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// This file is part of the uSTL library, an STL implementation.
2
//
3
// Copyright (c) 2005-2009 by Mike Sharov <msharov@users.sourceforge.net>
4
// This file is free software, distributed under the MIT License.
5
 
6
#ifndef USTDXEPT_H_46F7AE967738B588038F95E41158D7FF
7
#define USTDXEPT_H_46F7AE967738B588038F95E41158D7FF
8
 
9
#include "uexception.h"
10
#include "ustring.h"
11
 
12
namespace ustl {
13
 
14
enum {
15
    xfmt_ErrorMessage = 2,
16
    xfmt_LogicError = xfmt_ErrorMessage,
17
    xfmt_RuntimeError = xfmt_ErrorMessage
18
};
19
 
20
/// \class logic_error ustdxept.h ustl.h
21
/// \ingroup Exceptions
22
///
23
/// \brief Logic errors represent problems in the internal logic of the program.
24
///
25
class error_message : public exception {
26
public:
27
    explicit            error_message (const char* arg) throw();
28
    virtual            ~error_message (void) throw();
29
    inline virtual const char*  what (void) const throw() { return (m_Arg.c_str()); }
30
    inline virtual const char*  name (void) const throw() { return ("error"); }
31
    virtual void        info (string& msgbuf, const char* fmt = NULL) const throw();
32
    virtual void        read (istream& is);
33
    virtual void        write (ostream& os) const;
34
    virtual size_t      stream_size (void) const;
35
protected:
36
    string              m_Arg;
37
};
38
 
39
/// \class logic_error ustdxept.h ustl.h
40
/// \ingroup Exceptions
41
///
42
/// \brief Logic errors represent problems in the internal logic of the program.
43
///
44
class logic_error : public error_message {
45
public:
46
    inline explicit             logic_error (const char* arg) throw() : error_message (arg) {}
47
    inline virtual const char*  name (void) const throw() { return ("logic error"); }
48
};
49
 
50
/// \class domain_error ustdxept.h ustl.h
51
/// \ingroup Exceptions
52
///
53
/// \brief Reports domain errors ("domain" is in the mathematical sense)
54
///
55
class domain_error : public logic_error {
56
public:
57
    inline explicit             domain_error (const char* arg) throw() : logic_error (arg) {}
58
    inline virtual const char*  name (void) const throw() { return ("domain error"); }
59
};
60
 
61
/// \class invalid_argument ustdxept.h ustl.h
62
/// \ingroup Exceptions
63
///
64
/// \brief Reports an invalid argument to a function.
65
///
66
class invalid_argument : public logic_error {
67
public:
68
    inline explicit             invalid_argument (const char* arg) throw() : logic_error (arg) {}
69
    inline virtual const char*  name (void) const throw() { return ("invalid argument"); }
70
};
71
 
72
/// \class length_error ustdxept.h ustl.h
73
/// \ingroup Exceptions
74
///
75
/// \brief Reports when an object exceeds its allowed size.
76
///
77
class length_error : public logic_error {
78
public:
79
    inline explicit             length_error (const char* arg) throw() : logic_error (arg) {}
80
    inline virtual const char*  name (void) const throw() { return ("length error"); }
81
};
82
 
83
/// \class out_of_range ustdxept.h ustl.h
84
/// \ingroup Exceptions
85
///
86
/// \brief Reports arguments with values out of allowed range.
87
///
88
class out_of_range : public logic_error {
89
public:
90
    inline explicit             out_of_range (const char* arg) throw() : logic_error (arg) {}
91
    inline virtual const char*  name (void) const throw() { return ("out of range"); }
92
};
93
 
94
/// \class runtime_error ustdxept.h ustl.h
95
/// \ingroup Exceptions
96
///
97
/// \brief Reports errors that are dependent on the data being processed.
98
///
99
class runtime_error : public error_message {
100
public:
101
    inline explicit             runtime_error (const char* arg) throw() : error_message (arg) {}
102
    inline virtual const char*  name (void) const throw() { return ("runtime error"); }
103
};
104
 
105
/// \class range_error ustdxept.h ustl.h
106
/// \ingroup Exceptions
107
///
108
/// \brief Reports data that does not fall within the permitted range.
109
///
110
class range_error : public runtime_error {
111
public:
112
    inline explicit             range_error (const char* arg) throw() : runtime_error (arg) {}
113
    inline virtual const char*  name (void) const throw() { return ("range error"); }
114
};
115
 
116
/// \class overflow_error ustdxept.h ustl.h
117
/// \ingroup Exceptions
118
///
119
/// \brief Reports arithmetic overflow.
120
///
121
class overflow_error : public runtime_error {
122
public:
123
    inline explicit             overflow_error (const char* arg) throw() : runtime_error (arg) {}
124
    inline virtual const char*  name (void) const throw() { return ("overflow error"); }
125
};
126
 
127
/// \class underflow_error ustdxept.h ustl.h
128
/// \ingroup Exceptions
129
///
130
/// \brief Reports arithmetic underflow.
131
///
132
class underflow_error : public runtime_error {
133
public:
134
    inline explicit             underflow_error (const char* arg) throw() : runtime_error (arg) {}
135
    inline virtual const char*  name (void) const throw() { return ("underflow error"); }
136
};
137
 
138
} // namespace ustl
139
 
140
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.