EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DirWalker.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24 */
25 
26 #ifndef __DIRWALKER_H_INCL__
27 #define __DIRWALKER_H_INCL__
28 
38 class DirWalker
39 {
40 public:
41  DirWalker();
42  ~DirWalker();
43 
45  const char* currentFileName();
46 
56  bool OpenDir( const char* dir, const char* suffix = "" );
60  void CloseDir();
61 
71  bool NextFile();
72 
73 protected:
74 #ifdef HAVE_WINDOWS_H
75  HANDLE mFind;
76  WIN32_FIND_DATA mFindData;
77  bool mValid;
78  bool mFirst;
79 #else /* !HAVE_WINDOWS_H */
80  DIR* mDir;
81  struct dirent* mFile;
82  std::string mSuffix;
83 #endif /* !HAVE_WINDOWS_H */
84 };
85 
86 #endif // __DIRWALKER_H_INCL__
bool OpenDir(const char *dir, const char *suffix="")
Opens directory for listing.
Definition: DirWalker.cpp:58
const char * currentFileName()
Definition: DirWalker.cpp:49
std::string mSuffix
Definition: DirWalker.h:82
Simple class for directory listing.
Definition: DirWalker.h:38
DIR * mDir
Definition: DirWalker.h:80
void CloseDir()
Closes opened directory.
Definition: DirWalker.cpp:84
struct dirent * mFile
Definition: DirWalker.h:81
bool NextFile()
Iterates over to next file in directory.
Definition: DirWalker.cpp:101