00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plexcept.cpp,v 1.1 2004/05/21 21:02:52 maxx Exp $ 00005 | EXCEPT.CPP Exception Class 00006 | 00007 | Exception containing an error code and a string 00008 | describing the error in a user-friendly way. 00009 | The header file defines the error codes used. 00010 | 00011 | Copyright (c) 1996-1998 Ulrich von Zadow 00012 | 00013 \-------------------------------------------------------------------- 00014 */ 00015 00016 #include "plstdpch.h" 00017 00018 #include "plexcept.h" 00019 #include "plpaintlibdefs.h" 00020 00021 PLTextException::PLTextException 00022 ( int Code, 00023 const char * pszErr 00024 ) 00025 : PLObject(), 00026 m_Code(Code), 00027 m_pszErr(NULL) 00028 { 00029 #ifdef _WINDOWS 00030 SetErrorMode (0); // Restore normal error handling just in case 00031 // file system error checking was disabled. 00032 #endif 00033 00034 m_pszErr = new char[strlen(pszErr)+1]; 00035 strcpy (m_pszErr, pszErr); 00036 } 00037 00038 PLTextException::PLTextException 00039 ( const PLTextException& ex 00040 ) 00041 : PLObject(), 00042 m_Code( ex.m_Code ), 00043 m_pszErr( new char [strlen( ex.m_pszErr )+1] ) 00044 00045 { 00046 strcpy (m_pszErr, (const char *)ex); 00047 } 00048 00049 PLTextException::~PLTextException 00050 () 00051 { 00052 delete [] m_pszErr; 00053 } 00054 00055 int PLTextException::GetCode 00056 () 00057 const 00058 { 00059 return m_Code; 00060 } 00061 00062 PLTextException::operator const char * 00063 () 00064 const 00065 // This operator allows the exception to be treated as a string 00066 // whenever needed. 00067 { 00068 return m_pszErr; 00069 } 00070 /* 00071 /-------------------------------------------------------------------- 00072 | 00073 | $Log: plexcept.cpp,v $ 00074 | Revision 1.1 2004/05/21 21:02:52 maxx 00075 | Initial Version of vuVolume, moderatly changed to make it compile on my windows and linux machine. 00076 | 00077 | Revision 1.1 2002/11/13 01:58:21 mspindle 00078 | *** empty log message *** 00079 | 00080 | Revision 1.2 2001/10/06 22:37:08 uzadow 00081 | Linux compatibility. 00082 | 00083 | Revision 1.1 2001/09/16 19:03:22 uzadow 00084 | Added global name prefix PL, changed most filenames. 00085 | 00086 | Revision 1.6 2001/02/04 14:31:52 uzadow 00087 | Member initialization list cleanup (Erik Hoffmann). 00088 | 00089 | Revision 1.5 2001/01/21 14:28:21 uzadow 00090 | Changed array cleanup from delete to delete[]. 00091 | 00092 | Revision 1.4 2000/01/16 20:43:13 anonymous 00093 | Removed MFC dependencies 00094 | 00095 | Revision 1.3 1999/10/03 18:50:51 Ulrich von Zadow 00096 | Added automatic logging of changes. 00097 | 00098 | 00099 -------------------------------------------------------------------- 00100 */