ZipException.h

Go to the documentation of this file.
00001 
00002 // $RCSfile: ZipException.h,v $
00003 // $Revision: 1.5 $
00004 // $Date: 2006/04/04 12:11:18 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyrighted 2000 - 2006 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 // 
00014 // For the licensing details see the file License.txt
00016 
00024 #if !defined(AFX_ZIPEXCEPTION_H__E3546921_D728_11D3_B7C7_E77339672847__INCLUDED_)
00025 #define AFX_ZIPEXCEPTION_H__E3546921_D728_11D3_B7C7_E77339672847__INCLUDED_
00026 
00027 #if _MSC_VER > 1000
00028 #pragma once
00029 #pragma warning( push )
00030 #pragma warning (disable:4702) // disable "Unreachable code" warning in Throw function in the Release mode
00031 #endif // _MSC_VER > 1000
00032 
00033 
00034 #include "ZipString.h"
00035 #include "ZipBaseException.h"
00036 #include "ZipExport.h"
00037 
00038 #define ZIP_ENABLE_ERROR_DESCRIPTION
00039  
00045 class ZIP_API CZipException : public CZipBaseException
00046 {
00047 public:
00048 
00055   CZipException(int iCause = generic, LPCTSTR lpszZipName = NULL);
00056 
00057   CZipException(CZipException& e)
00058   {
00059    m_szFileName = e.m_szFileName;
00060    m_iCause = e.m_iCause;
00061   }
00062 
00078  static void Throw(int iZipError = CZipException::generic, LPCTSTR lpszZipName = NULL)
00079  {
00080   #ifdef _MFC_VER
00081    throw new CZipException(iZipError, lpszZipName);
00082   #else
00083    CZipException e(iZipError, lpszZipName);
00084    throw e;
00085   #endif
00086  }
00087 
00088   
00096  static int ZlibErrToZip(int iZlibError);
00097 
00098 
00099 #ifdef ZIP_ENABLE_ERROR_DESCRIPTION
00100 
00109  CZipString GetErrorDescription();
00110 
00111  
00135  BOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError, UINT* = NULL);
00136 
00137 #endif //ZIP_ENABLE_ERROR_DESCRIPTION
00138 
00142  CZipString m_szFileName;
00143 
00147  enum ZipErrors
00148  {
00149   noError,   
00150 //     1 - 42 reserved for errno (from STL) values - used only in non-MFC versions
00151 //     43 - 99 reserved
00152   generic  = 100, 
00153   badZipFile,   
00154   badCrc,    
00155   noCallback,   
00156   aborted,   
00157   abortedAction,  
00158   abortedSafely,  
00159   nonRemovable,  
00160   tooManyVolumes,  
00161   tooLongFileName, 
00162   badPassword,  
00163   dirWithSize,  
00164   internal,   
00165   notRemoved,   
00166   notRenamed,   
00167   platfNotSupp,  
00168   cdirNotFound,  
00169   streamEnd = 500, 
00170   needDict,   
00171   errNo,    
00172   streamError,  
00173   dataError,   
00174   memError,   
00175   bufError,   
00176   versionError,  
00177  };
00178 
00179 
00180 
00184  int m_iCause;
00185 
00186  
00187  virtual ~CZipException() throw();
00188 protected:
00189 
00190 #ifdef ZIP_ENABLE_ERROR_DESCRIPTION
00191 
00192 
00202  CZipString GetInternalErrorDescription(int iCause, bool bNoLoop = false);
00203 
00204 
00211  CZipString GetSystemErrorDescription();
00212 
00213 
00214 #endif //ZIP_ENABLE_ERROR_DESCRIPTION
00215 
00216 #ifdef _MFC_VER
00217  DECLARE_DYNAMIC(CZipException)
00218  #pragma warning( pop )
00219 #endif
00220 };
00221 
00222 
00223 #endif // !defined(AFX_ZIPEXCEPTION_H__E3546921_D728_11D3_B7C7_E77339672847__INCLUDED_)
00224 
00225 

ZipArchive Copyright © 2000 - 2006 Tadeusz Dracz . Generated at Fri Apr 7 13:55:23 2006.