]>
Dogcows Code - chaz/yoink/blob - src/Moof/Error.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
12 #ifndef _MOOF_ERROR_HH_
13 #define _MOOF_ERROR_HH_
15 #include <cstring> // strncpy
23 class Error
: public std::exception
29 UNINITIALIZED
= -1, // -
31 ALC_INIT
, // description
32 FASTEVENTS_INIT
, // description
33 FILE_NOT_FOUND
, // path of missing file
34 OPENAL_INIT
, // description
35 RESOURCE_NOT_FOUND
, // name of missing resource
36 SCRIPT_ERROR
, // description
37 SDL_INIT
, // description
39 UNKNOWN_AUDIO_FORMAT
, // name of resource
40 UNKNOWN_IMAGE_FORMAT
, // name of resource
43 explicit Error(unsigned code
= NONE
, const std::string
& what
= "")
47 virtual ~Error() throw() {}
49 void init(unsigned code
= NONE
, const std::string
& what
= "")
51 strncpy(mWhat
, what
.c_str(), sizeof(mWhat
)-1);
52 mWhat
[sizeof(mWhat
)-1] = '\0';
56 virtual void raise() const
61 unsigned code() const throw()
66 const char* what() const throw()
71 operator bool () const
73 // resolves to true if error code is not NONE
92 #endif // _MOOF_ERROR_HH_
This page took 0.034995 seconds and 4 git commands to generate.