roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
posix_directory.h
Go to the documentation of this file.
1#pragma once
2
4
5#if ROO_IO_FS_SUPPORT_POSIX
6
7#include <dirent.h>
8
9#include <memory>
10#include <string>
11
12#include "roo_io/fs/directory.h"
14
15namespace roo_io {
16
17class PosixDirectoryImpl : public DirectoryImpl {
18 public:
19 PosixDirectoryImpl(std::shared_ptr<MountImpl> mount, const char* path,
20 DIR* dir, Status status);
21
22 bool close() override;
23
24 const char* path() const override { return path_.c_str(); }
25
26 // const char* name() const override { return GetFileName(path_.c_str()); }
27
28 Status status() const override { return status_; }
29
30 void rewind() override;
31
32 bool read(Directory::Entry& entry) override;
33
34 private:
35 std::shared_ptr<MountImpl> mount_;
36 std::string path_;
37 DIR* dir_;
38 Status status_;
39 struct dirent* next_;
40 std::string file_;
41};
42
43} // namespace roo_io
44
45#endif // ROO_IO_FS_SUPPORT_POSIX
Definition byte.h:6
roo::basic_string_view< CharT, Traits > basic_string_view
Definition string_view.h:8
Status
Definition status.h:7