ReactOS  0.4.14-dev-384-g5b37caa
CZipEnumerator Struct Reference

#include <CZipEnumerator.hpp>

Public Member Functions

 CZipEnumerator ()
 
bool initialize (IZip *zip)
 
bool reset ()
 
bool next_unique (const char *prefix, CStringA &name, bool &folder, unz_file_info64 &info)
 
bool next (CStringA &name, unz_file_info64 &info)
 

Private Attributes

CComPtr< IZipm_Zip
 
bool m_First
 
CAtlList< CStringA > m_Returned
 

Detailed Description

Definition at line 8 of file CZipEnumerator.hpp.

Constructor & Destructor Documentation

◆ CZipEnumerator()

CZipEnumerator::CZipEnumerator ( )
inline

Definition at line 15 of file CZipEnumerator.hpp.

16  :m_First(true)
17  {
18  }

Member Function Documentation

◆ initialize()

bool CZipEnumerator::initialize ( IZip zip)
inline

Definition at line 20 of file CZipEnumerator.hpp.

21  {
22  m_Zip = zip;
23  return reset();
24  }
CComPtr< IZip > m_Zip

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

◆ next()

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

Definition at line 68 of file CZipEnumerator.hpp.

69  {
70  int err;
71 
72  unzFile uf = m_Zip->getZip();
73  if (!m_First)
74  {
75  err = unzGoToNextFile(uf);
77  {
78  return false;
79  }
80  }
81  m_First = false;
82 
83  err = unzGetCurrentFileInfo64(uf, &info, NULL, 0, NULL, 0, NULL, 0);
84  if (err == UNZ_OK)
85  {
86  PSTR buf = name.GetBuffer(info.size_filename);
87  err = unzGetCurrentFileInfo64(uf, NULL, buf, name.GetAllocLength(), NULL, 0, NULL, 0);
88  name.ReleaseBuffer(info.size_filename);
89  name.Replace('\\', '/');
90  }
91  return err == UNZ_OK;
92  }
CComPtr< IZip > m_Zip
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
voidp unzFile
Definition: unzip.h:70
#define UNZ_OK
Definition: unzip.h:74
int ZEXPORT unzGoToNextFile(unzFile file)
Definition: unzip.c:1199
smooth NULL
Definition: ftsmooth.c:416
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:1124
#define err(...)
signed char * PSTR
Definition: retypes.h:7
Definition: name.c:36
#define UNZ_END_OF_LIST_OF_FILE
Definition: unzip.h:75

Referenced by CZipExtract::Extract(), and next_unique().

◆ next_unique()

bool CZipEnumerator::next_unique ( const char prefix,
CStringA &  name,
bool folder,
unz_file_info64 info 
)
inline

Definition at line 36 of file CZipEnumerator.hpp.

37  {
38  size_t len = strlen(prefix);
39  CStringA tmp;
40  while (next(tmp, info))
41  {
42  if (!_strnicmp(tmp, prefix, len))
43  {
44  int pos = tmp.Find('/', len);
45  if (pos < 0)
46  {
47  name = tmp.Mid(len);
48  folder = false;
49  }
50  else
51  {
52  name = tmp.Mid(len, pos - len);
53  folder = true;
54  }
55  tmp = name.MakeLower();
56 
57  POSITION it = m_Returned.Find(tmp);
58  if (!name.IsEmpty() && !it)
59  {
60  m_Returned.AddTail(tmp);
61  return true;
62  }
63  }
64  }
65  return false;
66  }
Definition: fci.c:115
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
CAtlList< CStringA > m_Returned
GLenum GLsizei len
Definition: glext.h:6722
bool next(CStringA &name, unz_file_info64 &info)
CAtlStringA CStringA
Definition: atlstr.h:131
Definition: name.c:36

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

◆ reset()

bool CZipEnumerator::reset ( void  )
inline

Definition at line 26 of file CZipEnumerator.hpp.

27  {
28  unzFile uf = m_Zip->getZip();
29  m_First = true;
30  if (unzGoToFirstFile(uf) != UNZ_OK)
31  return false;
32  m_Returned.RemoveAll();
33  return true;
34  }
CComPtr< IZip > m_Zip
int ZEXPORT unzGoToFirstFile(unzFile file)
Definition: unzip.c:1178
voidp unzFile
Definition: unzip.h:70
#define UNZ_OK
Definition: unzip.h:74
CAtlList< CStringA > m_Returned

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

Member Data Documentation

◆ m_First

bool CZipEnumerator::m_First
private

Definition at line 12 of file CZipEnumerator.hpp.

Referenced by next(), and reset().

◆ m_Returned

CAtlList<CStringA> CZipEnumerator::m_Returned
private

Definition at line 13 of file CZipEnumerator.hpp.

Referenced by next_unique(), and reset().

◆ m_Zip

CComPtr<IZip> CZipEnumerator::m_Zip
private

Definition at line 11 of file CZipEnumerator.hpp.

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


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