DirEnumerator.h
Go to the documentation of this file.
1 
2 // This source file is part of the ZipArchive Library Open Source distribution
3 // and is Copyrighted 2000 - 2022 by Artpol Software - Tadeusz Dracz
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // For the licensing details refer to the License.txt file.
11 //
12 // Web Site: https://www.artpol-software.com
14 
21 #if !defined(ZIPARCHIVE_DIRENUMERATOR_DOT_H)
22 #define ZIPARCHIVE_DIRENUMERATOR_DOT_H
23 
24 #if _MSC_VER > 1000
25  #pragma once
26  #pragma warning( push )
27  #pragma warning (disable : 4100) // unreferenced formal parameter
28  #if defined ZIP_HAS_DLL
29  #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
30  #endif
31 #endif
32 
33 #include "ZipString.h"
34 #include "ZipPathComponent.h"
35 #include "FileFilter.h"
36 
40 namespace ZipArchiveLib
41 {
46  class ZIP_API CDirEnumerator
47  {
48  LPCTSTR m_lpszDirectory;
49  LPCTSTR m_lpszFileNameMask;
50  bool m_bRecursive;
51  CZipString m_szCurrentDirectory;
52  protected:
68  CDirEnumerator(LPCTSTR lpszDirectory, bool bRecursive = true)
69  {
70  CZipString dir(lpszDirectory);
71  if (dir.IsEmpty())
72  m_lpszDirectory = _T(".");
73  else
74  m_lpszDirectory = lpszDirectory;
75  m_bRecursive = bRecursive;
76  m_lpszFileNameMask = NULL;
77  }
78 
97  virtual bool Process(LPCTSTR lpszPath, const CFileInfo& info) = 0;
98 
105  virtual void OnEnumerationBegin(){}
106 
117  virtual void OnEnumerationEnd(bool bResult){}
118 
127  virtual void EnterDirectory(){}
128 
137  virtual void ExitDirectory(){}
138 
139  public:
140 
150  LPCTSTR GetDirectory() const {return m_lpszDirectory;}
151 
162  bool IsRecursive() const {return m_bRecursive;}
163 
170  LPCTSTR GetCurrentDirectory() const {return m_szCurrentDirectory;}
171 
185  bool Start(CFileFilter& filter);
186 
187  virtual ~CDirEnumerator(){}
188  private:
189  static bool IsDots(LPCTSTR lpszName);
190  };
191 
192 }
193 
194 #if _MSC_VER > 1000
195  #pragma warning( pop )
196 #endif
197 
198 #endif
199 

The ZipArchive Library Copyright © 2000 - 2022 Artpol Software - Tadeusz Dracz. Generated at Sat Dec 17 2022 19:57:03.