📄 zipexception.h
字号:
////////////////////////////////////////////////////////////////////////////////
// $Workfile: ZipException.h $
// $Archive: /ZipArchive/ZipException.h $
// $Date: 02-03-31 16:59 $ $Author: Tadeusz Dracz $
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// For the licensing details see the file License.txt
////////////////////////////////////////////////////////////////////////////////
/**
* \file ZipException.h
* Interface for the CZipException class.
*
*/
#if !defined(AFX_ZIPEXCEPTION_H__E3546921_D728_11D3_B7C7_E77339672847__INCLUDED_)
#define AFX_ZIPEXCEPTION_H__E3546921_D728_11D3_B7C7_E77339672847__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#pragma warning( push )
#pragma warning (disable:4702) // disable "Unreachable code" warning in Throw function in the Release mode
#endif // _MSC_VER > 1000
#include "ZipString.h"
#include "ZipBaseException.h"
#include "ZipExport.h"
#define ZIP_ENABLE_ERROR_DESCRIPTION
/**
A class representing exceptions specific to the ZipArchive library.
Library exception class derived in the MFC version from \c CException
and in non-MFC version from \c std::exception.
*/
class ZIP_API CZipException : public CZipBaseException
{
public:
/**
\param iCause
error cause (takes one of the #ZipErrors enumeration codes)
\param lpszZipName
the name of the file where the error occurred (if applicable)
*/
CZipException(int iCause = generic, LPCTSTR lpszZipName = NULL);
CZipException::CZipException(CZipException& e)
{
m_szFileName = e.m_szFileName;
m_iCause = e.m_iCause;
}
/**
Throw an exception.
Throw CZipException* in the MFC version of the library
(the object must be deleted with Delete() method)
and CZipException in other versions.
The arguments are the same as in CZipException().
\param iZipError
\param lpszZipName
\see CZipException()
*/
static void Throw(int iZipError = CZipException::generic, LPCTSTR lpszZipName = NULL)
{
#ifdef _MFC_VER
throw new CZipException(iZipError, lpszZipName);
#else
CZipException e(iZipError, lpszZipName);
throw e;
#endif
}
/**
Convert a zlib library error code to a \link #ZipErrors CZipException error code \endlink
\param iZlibError
zlib library error code
\return \link #ZipErrors CZipException error code \endlink
*/
static int ZlibErrToZip(int iZlibError);
#ifdef ZIP_ENABLE_ERROR_DESCRIPTION
/**
Return the error description.
\note You need to have defined ZIP_ENABLE_ERROR_DESCRIPTION
(in file ZipException.h); undefine this value if you don't want to
store the messages in the library.
*/
CZipString GetErrorDescription();
/**
Return the description of the error based on system variables
(this function is provided only for compatibility with MFC \c CException::GetErrorMessage)
\param lpszError
a pointer to a buffer that will receive the error message
if \c NULL
\param nMaxError
the maximum number of characters the buffer can hold, including the NULL terminator
\return
\c TRUE if the error string is not empty
\note
- The function will not copy more than \c nMaxError
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -