ReactOS 0.4.15-dev-7958-gcd0bb1a
CZipEnumerator Struct Reference

#include <CZipEnumerator.hpp>

Public Member Functions

 CZipEnumerator ()
 
bool initialize (IZip *zip)
 
bool reset ()
 
bool next_unique (PCWSTR prefix, CStringW &name, bool &folder, unz_file_info64 &info)
 
bool next (CStringW &name, unz_file_info64 &info)
 

Private Attributes

CComPtr< IZipm_Zip
 
bool m_First
 
CAtlList< CStringW > m_Returned
 
UINT m_nCodePage
 

Detailed Description

Definition at line 9 of file CZipEnumerator.hpp.

Constructor & Destructor Documentation

◆ CZipEnumerator()

CZipEnumerator::CZipEnumerator ( )
inline

Definition at line 17 of file CZipEnumerator.hpp.

18 : m_First(true)
20 {
21 }
#define TRUE
Definition: types.h:120
UINT GetZipCodePage(BOOL bUnZip)
Definition: zipfldr.cpp:90

Member Function Documentation

◆ initialize()

bool CZipEnumerator::initialize ( IZip zip)
inline

Definition at line 23 of file CZipEnumerator.hpp.

24 {
25 m_Zip = zip;
26 return reset();
27 }
CComPtr< IZip > m_Zip

Referenced by CZipExtract::Extract(), and CEnumZipContents::Initialize().

◆ next()

bool CZipEnumerator::next ( CStringW &  name,
unz_file_info64 info 
)
inline

Definition at line 72 of file CZipEnumerator.hpp.

73 {
74 int err;
75
76 unzFile uf = m_Zip->getZip();
77 if (!m_First)
78 {
79 err = unzGoToNextFile(uf);
81 {
82 return false;
83 }
84 }
85 m_First = false;
86
87 err = unzGetCurrentFileInfo64(uf, &info, NULL, 0, NULL, 0, NULL, 0);
88 if (err == UNZ_OK)
89 {
90 CStringA nameA;
91 PSTR buf = nameA.GetBuffer(info.size_filename);
92 err = unzGetCurrentFileInfo64(uf, NULL, buf, nameA.GetAllocLength(), NULL, 0, NULL, 0);
93 nameA.ReleaseBuffer(info.size_filename);
94 nameA.Replace('\\', '/');
95
96 if (info.flag & MINIZIP_UTF8_FLAG)
97 name = CA2WEX<MAX_PATH>(nameA, CP_UTF8);
98 else
99 name = CA2WEX<MAX_PATH>(nameA, m_nCodePage);
100 }
101 return err == UNZ_OK;
102 }
#define NULL
Definition: types.h:112
#define MINIZIP_UTF8_FLAG
Definition: precomp.h:43
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
CAtlStringA CStringA
Definition: atlstr.h:131
#define err(...)
#define CP_UTF8
Definition: nls.h:20
Definition: name.c:39
char * PSTR
Definition: typedefs.h:51
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:1129
int ZEXPORT unzGoToNextFile(unzFile file)
Definition: unzip.c:1204
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75
voidp unzFile
Definition: unzip.h:70
#define UNZ_OK
Definition: unzip.h:74

Referenced by CZipExtract::Extract().

◆ next_unique()

bool CZipEnumerator::next_unique ( PCWSTR  prefix,
CStringW &  name,
bool folder,
unz_file_info64 info 
)
inline

Definition at line 39 of file CZipEnumerator.hpp.

40 {
41 size_t len = wcslen(prefix);
42 CStringW tmp;
43 while (next(tmp, info))
44 {
45 if (!_wcsnicmp(tmp, prefix, len))
46 {
47 int pos = tmp.Find(L'/', len);
48 if (pos < 0)
49 {
50 name = tmp.Mid(len);
51 folder = false;
52 }
53 else
54 {
55 name = tmp.Mid(len, pos - len);
56 folder = true;
57 }
58 tmp = name;
59 tmp.MakeLower();
60
61 POSITION it = m_Returned.Find(tmp);
62 if (!name.IsEmpty() && !it)
63 {
64 m_Returned.AddTail(tmp);
65 return true;
66 }
67 }
68 }
69 return false;
70 }
GLenum GLsizei len
Definition: glext.h:6722
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
CAtlStringW CStringW
Definition: atlstr.h:130
#define L(x)
Definition: ntvdm.h:50
static unsigned __int64 next
Definition: rand_nt.c:6
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
CAtlList< CStringW > m_Returned
Definition: fci.c:116

Referenced by CEnumZipContents::Next(), and CEnumZipContents::Skip().

◆ reset()

bool CZipEnumerator::reset ( )
inline

Definition at line 29 of file CZipEnumerator.hpp.

30 {
31 unzFile uf = m_Zip->getZip();
32 m_First = true;
33 if (unzGoToFirstFile(uf) != UNZ_OK)
34 return false;
35 m_Returned.RemoveAll();
36 return true;
37 }
int ZEXPORT unzGoToFirstFile(unzFile file)
Definition: unzip.c:1183

Referenced by initialize(), and CEnumZipContents::Reset().

Member Data Documentation

◆ m_First

bool CZipEnumerator::m_First
private

Definition at line 13 of file CZipEnumerator.hpp.

Referenced by next(), and reset().

◆ m_nCodePage

UINT CZipEnumerator::m_nCodePage
private

Definition at line 15 of file CZipEnumerator.hpp.

Referenced by next().

◆ m_Returned

CAtlList<CStringW> CZipEnumerator::m_Returned
private

Definition at line 14 of file CZipEnumerator.hpp.

Referenced by next_unique(), and reset().

◆ m_Zip

CComPtr<IZip> CZipEnumerator::m_Zip
private

Definition at line 12 of file CZipEnumerator.hpp.

Referenced by initialize(), next(), and reset().


The documentation for this struct was generated from the following file: