00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00021 #if !defined(ZIPARCHIVE_ZIPEXCEPTION_DOT_H)
00022 #define ZIPARCHIVE_ZIPEXCEPTION_DOT_H
00023
00024 #if _MSC_VER > 1000
00025 #pragma once
00026 #pragma warning( push )
00027 #pragma warning (disable:4702) // disable "Unreachable code" warning in Throw function in the Release mode
00028 #if defined ZIP_HAS_DLL
00029 #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
00030 #pragma warning( disable : 4275 ) // non dll-interface used as base for dll-interface class
00031 #endif
00032 #endif
00033
00034
00035 #include "ZipString.h"
00036 #include "ZipBaseException.h"
00037 #include "ZipExport.h"
00038
00045 class ZIP_API CZipException : public CZipBaseException
00046 {
00047 public:
00048
00064 static void Throw(int iCause = CZipException::genericError, LPCTSTR lpszZipName = NULL)
00065 {
00066 #ifdef _ZIP_IMPL_MFC
00067 throw new CZipException(iCause, lpszZipName);
00068 #else
00069 CZipException e(iCause, lpszZipName);
00070 throw e;
00071 #endif
00072 }
00073
00084 CZipException(int iCause = genericError, LPCTSTR lpszZipName = NULL);
00085
00086 CZipException(CZipException& e)
00087 {
00088 m_szFileName = e.m_szFileName;
00089 m_iCause = e.m_iCause;
00090 m_iSystemError = e.m_iSystemError;
00091 }
00092
00093 #ifdef _ZIP_ENABLE_ERROR_DESCRIPTION
00094
00101 CZipString GetErrorDescription();
00102
00103
00122 ZBOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError, UINT* = NULL);
00123
00124 #endif //_ZIP_ENABLE_ERROR_DESCRIPTION
00125
00129 CZipString m_szFileName;
00130
00134 enum ZipErrors
00135 {
00136 noError,
00137
00138
00139 genericError = 100,
00140 badZipFile,
00141 badCrc,
00142 noCallback,
00143 noVolumeSize,
00144 aborted,
00145 abortedAction,
00146 abortedSafely,
00147 nonRemovable,
00148 tooManyVolumes,
00149 tooManyFiles,
00150 tooLongData,
00151 tooBigSize,
00152 badPassword,
00153 dirWithSize,
00154 internalError,
00155 fileError,
00156 notRemoved,
00157 notRenamed,
00158 platfNotSupp,
00159 cdirNotFound,
00160 noZip64,
00161 noAES,
00162 #ifdef _ZIP_IMPL_STL
00163 outOfBounds,
00164 #endif
00165 #ifdef _ZIP_USE_LOCKING
00166 mutexError,
00167 #endif
00168 streamEnd = 500,
00169 needDict,
00170 errNo,
00171 streamError,
00172 dataError,
00173 memError,
00174 bufError,
00175 versionError,
00176 };
00177
00181 int m_iCause;
00186 ZIP_SYSTEM_ERROR_TYPE m_iSystemError;
00187 virtual ~CZipException() throw();
00188
00189 protected:
00190
00191 #ifdef _ZIP_ENABLE_ERROR_DESCRIPTION
00192
00205 CZipString GetInternalErrorDescription(int iCause, bool bNoLoop = false);
00206
00207
00214 CZipString GetSystemErrorDescription();
00215
00216
00217 #endif //_ZIP_ENABLE_ERROR_DESCRIPTION
00218
00219 #if defined _MFC_VER && defined _ZIP_IMPL_MFC
00220 DECLARE_DYNAMIC(CZipException)
00221 #endif
00222 };
00223
00224 #if _MSC_VER > 1000
00225 #pragma warning( pop )
00226 #endif
00227
00228 #endif // !defined(ZIPARCHIVE_ZIPEXCEPTION_DOT_H)
00229
00230