/usr/include/tse3/Error.h is in libtse3-dev 0.3.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | /*
* @(#)Error.h 3.00 22 June 2000
*
* Copyright (c) 2000 Pete Goodliffe (pete@cthree.org)
*
* This file is part of TSE3 - the Trax Sequencer Engine version 3.00.
*
* This library is modifiable/redistributable under the terms of the GNU
* General Public License.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING. If not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef TSE3_ERROR_H
#define TSE3_ERROR_H
#include <string>
#include <exception>
namespace TSE3
{
/**************************************************************************
* General error handling declarations
*************************************************************************/
/**
* This enum type represents each of the different types of error that
* may be raised by the TSE3 API. They are used by the exception class
* @ref Error and it's subclasses.
*
* You can use the @ref errString() function to convert the ErrorCode into
* an English description string.
*
* @see Error
* @see errString
*/
enum ErrorCode
{
// Song error codes
TrackAlreadyInsertedErr,
// Track error codes
PartAlreadyInsertedErr,
PartOverlapErr,
NoPartInsertedErr,
// Track and Part error codes
PartTimeErr,
PhraseUnparentedErr,
// Phraselist error codes
PhraseNameExistsErr,
PhraseAlreadyInsertedErr,
InvalidPhraseNameErr,
// MidiFile error codes
MidiFileImportErr,
MidiFileExportErr,
// Serializable error codes (via TSE3MDL, TSE2MDL)
CouldntOpenFileErr,
InvalidFileTypeErr,
FileFormatErr,
// MidiScheduler error codes,
MidiSchedulerCreateErr,
/**
* An error not specified by the core TSE3 library.
*/
OtherErr,
/**
* A convenience value representing the number of TSE3 error reason
* codes.
*/
NoErrorCodes
};
/**
* This is the base class of all TSE3 errors.
*
* The Error class provides a reason code for each type of error that
* can be raised, although subclasses are also used to distinguish the
* type of the error. Each subclass may have more than one reason code
* associated with it. The reason codes are provided by the
* @ref ErrorCodes enum type.
*
* The rationale for the reason codes, rather than use of pure subclassing
* to denote error type, is to allow the application to provide
* internationalised error messages for the user. It is easier to lookup a
* string via an integer reason code than convert a class type to some
* error string. (See @ref ErrorCode and @ref errString() for more
* information on this.)
*
* @short TSE3 exception base class
* @author Pete Goodliffe
* @version 3.00
*/
class Error : public std::exception
{
public:
/**
* Creates an Error object with the specified reason code.
*
* @param reason Reason code for this Error
*/
Error(ErrorCode reason) : _reason(reason) {}
~Error() throw () {}
/**
* Returns the @ref ErrorCode for this Error object.
*
* Use @ref errString to get a string representation of this
* error.
*/
ErrorCode reason() const { return _reason; }
/**
* @reimplemented
*
* @see TSE3::errString
*/
virtual const char *what() const throw();
private:
ErrorCode _reason;
};
/**
* Returns a string containing an English representation of the
* specified TSE3 @ref ErrorCode.
*
* @see ErrorCode
* @see Error
*/
const char *errString(ErrorCode reason);
/**************************************************************************
* Specific Error subclasses
*************************************************************************/
/**
* Class of exception thrown by the @ref MidiFileImport class.
*
* @short Exception thrown by MidiFileImport
* @author Pete Goodliffe
* @version 3.00
* @see Song
*/
class MidiFileImportError : public Error
{
public:
MidiFileImportError(std::string const &str)
: Error(MidiFileImportErr), s(str) {}
~MidiFileImportError() throw () {}
const std::string &operator *() const { return s; }
private:
const std::string s;
};
/**
* Class of exception thrown by the @ref MidiFileExport class.
*
* @short Exception thrown by MidiFileExport
* @author Pete Goodliffe
* @version 3.00
* @see Song
*/
class MidiFileExportError : public Error
{
public:
MidiFileExportError(std::string const &str)
: Error(MidiFileExportErr), s(str) {}
~MidiFileExportError() throw () {}
const std::string &operator *() const { return s; }
private:
const std::string s;
};
/**
* Exception thrown by @ref PhraseList class.
*
* @short PhraseList exception
* @author Pete Goodliffe
* @version 3.00
* @see PhraseList
*/
class PhraseListError : public Error
{
public:
PhraseListError(ErrorCode rc) : Error(rc) {}
~PhraseListError() throw () {}
};
/**
* Class of exception thrown by the @ref Song insert methods.
*/
class SongError : public Error
{
public:
SongError(ErrorCode rc) : Error(rc) {}
~SongError() throw () {}
};
/**
* Class of exception thrown by the @ref Track class when inserting
* a @ref Part fails.
*/
class TrackError : public Error
{
public:
TrackError(ErrorCode rc) : Error(rc) {}
~TrackError() throw () {}
};
/**
* Class of exception thrown by the @ref Part class.
*/
class PartError : public Error
{
public:
PartError(ErrorCode rc) : Error(rc) {}
~PartError() throw () {}
};
/**
* Exception class thrown by OSS MidiScheduler classes.
*/
class MidiSchedulerError : public Error
{
public:
MidiSchedulerError(ErrorCode rc) : Error(rc) {}
~MidiSchedulerError() throw () {}
};
/**
* Exception class thrown by Serializable classes.
*/
class SerializableError : public Error
{
public:
SerializableError(ErrorCode rc) : Error(rc) {}
~SerializableError() throw () {}
};
}
#endif
|