ZipException.h
Go to the documentation of this file.
1 
2 // This source file is part of the ZipArchive Library Open Source distribution
3 // and is Copyrighted 2000 - 2022 by Artpol Software - Tadeusz Dracz
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // For the licensing details refer to the License.txt file.
11 //
12 // Web Site: https://www.artpol-software.com
14 
21 #if !defined(ZIPARCHIVE_ZIPEXCEPTION_DOT_H)
22 #define ZIPARCHIVE_ZIPEXCEPTION_DOT_H
23 
24 #if _MSC_VER > 1000
25 #pragma once
26 #pragma warning( push )
27 #pragma warning (disable:4702) // disable "Unreachable code" warning in Throw function in the Release mode
28  #if defined ZIP_HAS_DLL
29  #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
30  #pragma warning( disable : 4275 ) // non dll-interface used as base for dll-interface class
31  #endif
32 #endif
33 
34 
35 #include "ZipString.h"
36 #include "ZipBaseException.h"
37 #include "ZipExport.h"
38 
45 class ZIP_API CZipException : public CZipBaseException
46 {
47 public:
48 
64  static void Throw(int iCause = CZipException::genericError, LPCTSTR lpszZipName = NULL)
65  {
66  #ifdef _ZIP_IMPL_MFC
67  throw new CZipException(iCause, lpszZipName);
68  #else
69  CZipException e(iCause, lpszZipName);
70  throw e;
71  #endif
72  }
73 
84  CZipException(int iCause = genericError, LPCTSTR lpszZipName = NULL);
85 #if _MSC_VER > 1000
86 #pragma warning (disable : 26432)
87 #endif
89  {
90  m_szFileName = e.m_szFileName;
91  m_iCause = e.m_iCause;
92  m_iSystemError = e.m_iSystemError;
93  }
94 
95 #ifdef _ZIP_ENABLE_ERROR_DESCRIPTION
96 
103  CZipString GetErrorDescription();
104 
105 
124  ZBOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError, UINT* = NULL);
125 
126 #endif //_ZIP_ENABLE_ERROR_DESCRIPTION
127 
131  CZipString m_szFileName;
132 
137  {
139 // 1 - 199 reserved for errno (from STL) values - used only in non-MFC versions
140  genericError = 200,
164 #ifdef _ZIP_IMPL_STL
166 #endif
167 #ifdef _ZIP_USE_LOCKING
168  mutexError,
169 #endif
170  streamEnd = 500,
178  };
179 
183  int m_iCause;
188  ZIP_SYSTEM_ERROR_TYPE m_iSystemError;
189  virtual ~CZipException() _NOEXCEPT;
190 
191 protected:
192 
193 #ifdef _ZIP_ENABLE_ERROR_DESCRIPTION
194 
207  CZipString GetInternalErrorDescription(int iCause, bool bNoLoop = false);
208 
209 
216  CZipString GetSystemErrorDescription();
217 
218 
219 #endif //_ZIP_ENABLE_ERROR_DESCRIPTION
220 
221 #if defined _MFC_VER && defined _ZIP_IMPL_MFC
222  DECLARE_DYNAMIC(CZipException)
223 #endif
224 };
225 
226 #if _MSC_VER > 1000
227  #pragma warning( pop )
228 #endif
229 
230 #endif // !defined(ZIPARCHIVE_ZIPEXCEPTION_DOT_H)
231 
232 

The ZipArchive Library Copyright © 2000 - 2022 Artpol Software - Tadeusz Dracz. Generated at Sat Dec 17 2022 19:57:03.