annotate egglib/egglib-2.1.5/include/egglib-cpp/EggException.hpp @ 7:24336e3d3dd8 draft

planemo upload
author gandres
date Wed, 15 Jun 2016 09:35:15 -0400
parents 420b57c3c185
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
1 /*
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
2 Copyright 2009 Stéphane De Mita, Mathieu Siol
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
3
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
4 This file is part of the EggLib library.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
5
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
6 EggLib is free software: you can redistribute it and/or modify
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
8 the Free Software Foundation, either version 3 of the License, or
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
9 (at your option) any later version.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
10
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
11 EggLib is distributed in the hope that it will be useful,
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
14 GNU General Public License for more details.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
15
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
17 along with EggLib. If not, see <http://www.gnu.org/licenses/>.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
18 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
19
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
20 #ifndef EGGLIB_EGGEXCEPTION_HPP
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
21 #define EGGLIB_EGGEXCEPTION_HPP
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
22
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
23 #include <string>
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
24 #include <exception>
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
25
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
26 namespace egglib {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
27
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
28 /** \brief Base exception type for errors occurring in this library
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
29 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
30 * \ingroup core
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
31 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
32 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
33 class EggException : public std::exception {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
34 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
35 /// Constructor with empty error message
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
36 EggException();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
37 /// Creates the exception
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
38 EggException(const char* message);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
39 /// Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
40 ~EggException() throw() {}
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
41 /// Gets error message
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
42 virtual const char* what() const throw();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
43
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
44 protected:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
45 std::string message;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
46
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
47 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
48
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
49
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
50 /** \brief Exception type for memory errors
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
51 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
52 * \ingroup core
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
53 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
54 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
55 class EggMemoryError : public EggException {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
56 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
57 /// Creates the exception
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
58 EggMemoryError();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
59 /// Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
60 ~EggMemoryError() throw() {}
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
61 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
62
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
63
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
64 /** \brief Exception type for argument value errors
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
65 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
66 * \ingroup core
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
67 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
68 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
69 class EggArgumentValueError : public EggException {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
70 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
71 /// Creates the exception
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
72 EggArgumentValueError(const char* m );
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
73 /// Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
74 ~EggArgumentValueError() throw() {}
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
75 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
76
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
77
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
78 /** \brief Exception type for runtime errors
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
79 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
80 * Runtime error definition is rather large. Includes bugs as well
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
81 * as logical errors.
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
82 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
83 * \ingroup core
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
84 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
85 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
86 class EggRuntimeError : public EggException {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
87 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
88 /// Creates the exception
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
89 EggRuntimeError(const char* m );
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
90 /// Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
91 ~EggRuntimeError() throw() {}
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
92 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
93
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
94
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
95 /** \brief Exception type for file/string formatting errors
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
96 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
97 * \ingroup core
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
98 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
99 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
100 class EggFormatError : public EggException {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
101 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
102 /// Creates the exception
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
103 EggFormatError(const char* fileName, const char* expectedFormat, const char* m);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
104 /// Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
105 ~EggFormatError() throw() {}
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
106 /// Gets the file name
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
107 std::string fileName() const;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
108 /// Gets the expected format
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
109 std::string expectedFormat() const;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
110 /// Formats a longer string
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
111 virtual const char* what_more() const;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
112
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
113 protected:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
114 std::string fname;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
115 std::string eformat;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
116 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
117
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
118
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
119 /** \brief Exception type for errors while opening a file
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
120 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
121 * \ingroup core
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
122 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
123 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
124 class EggOpenFileError : public EggException {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
125 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
126 /// Creates the exception
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
127 EggOpenFileError(const char* fileName );
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
128 /// Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
129 ~EggOpenFileError() throw() {}
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
130 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
131
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
132
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
133 /** \brief Exception type for unaligned sequences
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
134 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
135 * \ingroup core
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
136 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
137 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
138 class EggUnalignedError : public EggException {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
139 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
140 /** \brief Creates the exception
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
141 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
142 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
143 EggUnalignedError();
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
144
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
145 /** \brief Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
146 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
147 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
148 ~EggUnalignedError() throw() {}
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
149 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
150
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
151 /** \brief Exception type for invalid character
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
152 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
153 * \ingroup core
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
154 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
155 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
156 class EggInvalidCharacterError : public EggException {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
157 public:
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
158 /** \brief Creates the exception
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
159 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
160 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
161 EggInvalidCharacterError(char c, unsigned int seqIndex, unsigned int posIndex);
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
162
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
163 /** \brief Destructor
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
164 *
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
165 */
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
166 ~EggInvalidCharacterError() throw() {}
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
167 };
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
168
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
169 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
170
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
171
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
172
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
173 #endif