exception.h

Go to the documentation of this file.
00001 
00007 /*
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Lesser General Public
00010     License as published by the Free Software Foundation; either
00011     version 2.1 of the License, or (at your option) any later version.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Lesser General Public License for more details.
00017 
00018     You should have received a copy of the GNU Lesser General Public
00019     License along with this library; if not, write to the Free Software
00020     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00021 */
00022 
00023 #ifndef OMGUI_EXCEPTION_H
00024 #define OMGUI_EXCEPTION_H
00025 
00026 #include <omgui/dllimpexp.h>
00027 #include <exception>
00028 
00029 namespace omgui {
00030 
00034 class OMGUI_EXCEPTION_API(OMGUI_API) Exception : public std::exception
00035 {
00036 public:
00037 
00038     // only add to the bottom of this enum...
00039     enum error_codes {
00041         SYSTEM = 1,
00043         WIDGET_NO_PARENT,
00045         NATIVE_HANDLE,
00047         GUI_INIT_FAILED,
00049         PANEL_NO_LAYOUT_MANAGER,
00051         EXISTING_OBJECT_ID,
00052     };
00053 
00054 protected:
00056     int m_code;
00058     int m_extra;
00060     int m_line;
00062     const char *m_file;
00063 
00064 public:
00065     Exception(int code, int line, const char *file, int extra = 0) throw();
00066     virtual ~Exception() throw();
00067 
00072     virtual const char *what() const  throw();
00073 
00077     const char *get_file() const throw();
00078 
00082     int get_line() const throw();
00083 
00087     int get_code() const throw();
00088 
00092     int get_extra() const throw();
00093 };
00094 
00095 class OMGUI_EXCEPTION_API(OMGUI_API) SystemError : public Exception
00096 {
00097 public:
00098     SystemError(int error, int line, char *file) throw()
00099         : Exception(SYSTEM, line, file, error)
00100     { }
00101 };
00102 
00103 } // omgui
00104 
00105 #endif

doxygen SourceForge.net Logo