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 "zstring_view.hh"
6#include <sys/types.h>
7
8namespace openmsx {
9
16{
17public:
18 ReadDir(const ReadDir&) = delete;
19 ReadDir& operator=(const ReadDir&) = delete;
20
21 explicit ReadDir(zstring_view directory);
22 ~ReadDir();
23
28 [[nodiscard]] struct dirent* getEntry();
29
32 [[nodiscard]] bool isValid() const { return dir != nullptr; }
33
34private:
35 DIR* dir;
36};
37
38} // namespace openmsx
39
40#endif
Simple wrapper around opendir() / readdir() / closedir() functions.
Definition ReadDir.hh:16
struct dirent * getEntry()
Get directory entry for next file.
Definition ReadDir.cc:17
ReadDir & operator=(const ReadDir &)=delete
bool isValid() const
Is the given directory valid (does it exist)?
Definition ReadDir.hh:32
ReadDir(const ReadDir &)=delete
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
Definition Autofire.cc:9