1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
// is Copyrighted 2000 - 2007 by Artpol Software - Tadeusz Dracz
//
// 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 refer to the License.txt file.
//
// Web Site: http://www.artpol-software.com
////////////////////////////////////////////////////////////////////////////////
#ifndef ZIPARCHIVE_ZIPFILE_DOT_H
#error Do not include this file directly. Include ZipFile.h instead
#endif
#if _MSC_VER > 1000 && defined ZIP_HAS_DLL
#pragma warning (push)
#pragma warning( disable : 4275 ) // non dll-interface used as base for dll-interface class
#endif
#include "ZipAbstractFile.h"
#include "ZipExport.h"
class ZIP_API CZipFile : public CZipAbstractFile, public CFile
{
public:
DECLARE_DYNAMIC(CZipFile)
void Flush(){CFile::Flush();}
CZipString GetFilePath() const
{
try
{
// it throws an exception when working on an offline file
return CFile::GetFilePath();
}
catch (CException* e)
{
e->Delete();
return this->m_strFileName;
}
}
ZIP_FILE_USIZE GetPosition() const {return CFile::GetPosition() ;}
void SetLength(ZIP_FILE_USIZE nNewLen) {CFile::SetLength(nNewLen);}
ZIP_FILE_USIZE Seek(ZIP_FILE_SIZE lOff , int nFrom){return CFile::Seek(lOff, nFrom);}
ZIP_FILE_USIZE GetLength() const {return CFile::GetLength();}
UINT Read(void *lpBuf, UINT nCount){return CFile::Read(lpBuf, nCount);}
void Write(const void* lpBuf, UINT nCount){CFile::Write(lpBuf, nCount);}
bool Open( LPCTSTR lpszFileName, UINT nOpenFlags, bool bThrowExc)
{
CFileException* e = new CFileException;
bool bRet = CFile::Open(lpszFileName, nOpenFlags, e) != 0;
if (!bRet && bThrowExc)
throw e;
e->Delete();
return bRet;
}
CZipFile();
bool IsClosed() const
{
return m_hFile == CFile::hFileNull;
}
CZipFile( LPCTSTR lpszFileName, UINT nOpenFlags ):CFile(lpszFileName, nOpenFlags)
{
}
void Close( )
{
if (!IsClosed())
CFile::Close();
}
operator HANDLE();
virtual ~CZipFile();
};
#if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
#pragma warning (pop)
#endif
|