Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cZipReader.h
Go to the documentation of this file.
1 //
6 //
7 
8 #ifndef _INC_cZipReader_H
9 #define _INC_cZipReader_H
10 #ifndef NO_PRAGMA_ONCE
11 #pragma once
12 #endif
13 
14 #include "cZipDir.h"
15 
16 #ifdef USE_ZLIB
19 
20 namespace GrayLib
21 {
22  class cZipFileEntry1;
23 
24  class GRAYLIB_LINK cZipReader // : public IResourceLoader
25  {
28 
29  public:
31 
32  // current file stuff.
36 
37  protected:
39 
40  protected:
43  HRESULT UnzipFileCurrent(cStreamOutput& so, const char* pszPassword = nullptr) const;
44  HRESULT UnzipFileCurrent(cStringF sPathDest, const char* pszPassword = nullptr) const;
45 
46  public:
48  virtual ~cZipReader();
49 
50  // simple interface
51  static HRESULT GRAYCALL Unzip(const FILECHAR_t* pszZipFilePath, const FILECHAR_t* pszDestFolder = nullptr, ZIP_CTRL_TYPE bZCtrl = 0, const char* pszPassword = nullptr, IStreamProgressCallback* pProgress = nullptr);
52 
53  // extended interface
55 
56  // ASSUMES OpenUnZip called()
57  HRESULT UnzipTo(const FILECHAR_t* pszDestFolder, ZIP_CTRL_TYPE bZCtrl = 0, const char* pszPassword = nullptr, IStreamProgressCallback* pProgress = nullptr); // unzips to specified folder
58 
59  // unzip by file index
60  int get_FileCount() const;
61  // get info for the current file.
63 
66  HRESULT GotoFileFirstExt(const FILECHAR_t* pszExt = nullptr);
67  HRESULT GotoFileNextExt(const FILECHAR_t* pszExt = nullptr);
69 
70  // unzip current file
71  HRESULT UnzipFile(const FILECHAR_t* pszDestFolder = nullptr, ZIP_CTRL_TYPE bZCtrl = 0, const char* pszPassword = nullptr);
72 
74  };
75 };
76 #endif // USE_ZLIB
77 #endif // !_INC_cZipReader_H
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
MIT License free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to and or sell copies of the and to permit persons to whom the Software is furnished to do so
Definition: LICENSE.txt:10
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cZipDir.h:94
Definition: cZipDir.h:331
Definition: cZipReader.h:25
HRESULT GotoFileNum(ITERATE_t nFile)
HRESULT GetFileInfo(cZipFileEntry1 &info) const
cZipFileEntry1 m_Entry
central header data for the current file
Definition: cZipReader.h:35
ZIP_OFFSET_t m_nOffsetCHEntry
position of the current file in the central directory. relative to get_PosLH0()
Definition: cZipReader.h:34
int get_FileCount() const
HRESULT GotoFileNextExt(const FILECHAR_t *pszExt=nullptr)
HRESULT GoToFileNext()
HRESULT UnzipTo(const FILECHAR_t *pszDestFolder, ZIP_CTRL_TYPE bZCtrl=0, const char *pszPassword=nullptr, IStreamProgressCallback *pProgress=nullptr)
static HRESULT GRAYCALL Unzip(const FILECHAR_t *pszZipFilePath, const FILECHAR_t *pszDestFolder=nullptr, ZIP_CTRL_TYPE bZCtrl=0, const char *pszPassword=nullptr, IStreamProgressCallback *pProgress=nullptr)
cStreamInput * m_pInp
Zip file I'm reading.
Definition: cZipReader.h:38
HRESULT GotoFileFind(const FILECHAR_t *pszFileName, ZIP_CTRL_TYPE bZCtrl=ZIP_CTRL_FLAT)
HRESULT GotoFileInfo(ITERATE_t nFile, cZipFileEntry1 &info)
ITERATE_t m_nFileNum
number of the current file in the zip file directory
Definition: cZipReader.h:33
HRESULT GoToFileFirst()
HRESULT UnzipFileCurrent(cStringF sPathDest, const char *pszPassword=nullptr) const
HRESULT OpenUnZip(cStreamInput &rInp)
cZipDir m_dir
central directory header.
Definition: cZipReader.h:30
HRESULT GotoFileFirstExt(const FILECHAR_t *pszExt=nullptr)
HRESULT UnzipFile(const FILECHAR_t *pszDestFolder=nullptr, ZIP_CTRL_TYPE bZCtrl=0, const char *pszPassword=nullptr)
UNITTEST_FRIEND(cZipReader)
HRESULT UnzipFileCurrent(cStreamOutput &so, const char *pszPassword=nullptr) const
Definition: cStream.h:306
Definition: cStream.h:126
Definition: cMesh.h:22
INT32 ZIP_OFFSET_t
relative file position in zip. offset relative to LH0.
Definition: cZipDir.h:24
@ ZIP_CTRL_FLAT
Definition: cZipDir.h:42
BYTE ZIP_CTRL_TYPE
Definition: cZipDir.h:44
int ITERATE_t
like size_t but signed
Definition: Index.h:28
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
Definition: cStreamProgress.h:168