]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Error.hh
included manager class
[chaz/yoink] / src / Moof / Error.hh
index 6dab32ffd07e14e93d8cbad3a6bc0620be5e4f7e..c452ae6df836f8351660b5cd0e460239f1932697 100644 (file)
@@ -43,9 +43,11 @@ public:
 
        enum Code
        {
-               NONE = 0,
+               UNINITIALIZED = -1,                     // -
+               NONE = 0,                                       // -
                ALC_INIT,                                       // description
                FASTEVENTS_INIT,                        // description
+               OPENAL_INIT,                            // description
                FILE_NOT_FOUND,                         // path of missing file
                RESOURCE_NOT_FOUND,                     // name of missing resource
                SCRIPT_ERROR,                           // description
@@ -55,7 +57,7 @@ public:
                UNKNOWN_IMAGE_FORMAT,           // name of resource
        };
 
-       explicit Error(unsigned code, const std::string& what = "")
+       explicit Error(unsigned code = NONE, const std::string& what = "")
        {
                init(code, what);
        }
@@ -68,7 +70,7 @@ public:
                mCode = code;
        }
 
-       virtual void raise()
+       virtual void raise() const
        {
                throw *this;
        }
@@ -83,11 +85,18 @@ public:
                return mWhat;
        }
 
-       bool isError() const throw()
+       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;
This page took 0.026417 seconds and 4 git commands to generate.