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