DirEnumerator.h
Go to the documentation of this file.
1 
2 // This source file is part of the ZipArchive library source distribution and
3 // is Copyrighted 2000 - 2013 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: http://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  }
77 
96  virtual bool Process(LPCTSTR lpszPath, const CFileInfo& info) = 0;
97 
104  virtual void OnEnumerationBegin(){}
105 
116  virtual void OnEnumerationEnd(bool bResult){}
117 
126  virtual void EnterDirectory(){}
127 
136  virtual void ExitDirectory(){}
137 
138  public:
139 
149  LPCTSTR GetDirectory() const {return m_lpszDirectory;}
150 
161  bool IsRecursive() const {return m_bRecursive;}
162 
169  LPCTSTR GetCurrentDirectory() const {return m_szCurrentDirectory;}
170 
184  bool Start(CFileFilter& filter);
185 
186  virtual ~CDirEnumerator(){}
187  private:
188  static bool IsDots(LPCTSTR lpszName);
189  };
190 
191 }
192 
193 #if _MSC_VER > 1000
194  #pragma warning( pop )
195 #endif
196 
197 #endif
198 

The ZipArchive Library Copyright © 2000 - 2013 Artpol Software - Tadeusz Dracz. Generated at Mon Feb 25 2013 16:29:20.