X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FMoof%2FError.hh;fp=src%2FMoof%2FError.hh;h=0000000000000000000000000000000000000000;hb=831f04d4bc19a390415ac0bbac4331c7a65509bc;hp=494dd60f8cf925c65f38ed8762e1218d31632980;hpb=299af4f2047e767e5d79501c26444473bda64c64;p=chaz%2Fyoink diff --git a/src/Moof/Error.hh b/src/Moof/Error.hh deleted file mode 100644 index 494dd60..0000000 --- a/src/Moof/Error.hh +++ /dev/null @@ -1,93 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#ifndef _MOOF_ERROR_HH_ -#define _MOOF_ERROR_HH_ - -#include // strncpy -#include -#include - - -namespace Mf { - - -class Error : public std::exception -{ -public: - - enum Code - { - UNINITIALIZED = -1, // - - NONE = 0, // - - ALC_INIT, // description - FASTEVENTS_INIT, // description - FILE_NOT_FOUND, // path of missing file - OPENAL_INIT, // description - RESOURCE_NOT_FOUND, // name of missing resource - SCRIPT_ERROR, // description - SDL_INIT, // description - SDL_VIDEOMODE, // - - UNKNOWN_AUDIO_FORMAT, // name of resource - UNKNOWN_IMAGE_FORMAT, // name of resource - }; - - explicit Error(unsigned code = NONE, const std::string& what = "") - { - init(code, what); - } - virtual ~Error() throw() {} - - void init(unsigned code = NONE, const std::string& what = "") - { - strncpy(mWhat, what.c_str(), sizeof(mWhat)-1); - mWhat[sizeof(mWhat)-1] = '\0'; - mCode = code; - } - - virtual void raise() const - { - throw *this; - } - - unsigned code() const throw() - { - return mCode; - } - - const char* what() const throw() - { - return mWhat; - } - - operator bool () const - { - // resolves to true if error code is not NONE - return mCode != NONE; - } - - void reset() throw() - { - mCode = NONE; - mWhat[0] = '\0'; - } - -private: - - unsigned mCode; - char mWhat[1024]; -}; - - -} // namespace Mf - -#endif // _MOOF_ERROR_HH_ -