openMSX
ReadDir.hh
Go to the documentation of this file.
1 #ifndef READDIR_HH
2 #define READDIR_HH
3 
4 #include "direntp.hh"
5 #include <string>
6 #include <sys/types.h>
7 
8 namespace openmsx {
9 
15 class ReadDir
16 {
17 public:
18  ReadDir(const ReadDir&) = delete;
19  ReadDir& operator=(const ReadDir&) = delete;
20 
21  explicit ReadDir(const std::string& directory);
22  ~ReadDir();
23 
28  struct dirent* getEntry();
29 
32  bool isValid() const { return dir != nullptr; }
33 
34 private:
35  DIR* dir;
36 };
37 
38 } // namespace openmsx
39 
40 #endif
ReadDir & operator=(const ReadDir &)=delete
ReadDir(const ReadDir &)=delete
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
Simple wrapper around openmdir() / readdir() / closedir() functions.
Definition: ReadDir.hh:15
bool isValid() const
Is the given directory valid (does it exist)?
Definition: ReadDir.hh:32
struct dirent * getEntry()
Get directory entry for next file.
Definition: ReadDir.cc:17