Dir class.
More...
#include <Dir.h>
|
| Dir () |
| Create an uninitialized directory. More...
|
|
| Dir (FileSystem *fs, const char *path) |
| Open a directory on a filesystem. More...
|
|
virtual | ~Dir () |
| Destroy a file. More...
|
|
virtual int | open (FileSystem *fs, const char *path) |
| Open a directory on the filesystem. More...
|
|
virtual int | close () |
| Close a directory. More...
|
|
virtual ssize_t | read (struct dirent *ent) |
| Read the next directory entry. More...
|
|
virtual void | seek (off_t offset) |
| Set the current position of the directory. More...
|
|
virtual off_t | tell () |
| Get the current position of the directory. More...
|
|
virtual void | rewind () |
| Rewind the current position to the beginning of the directory. More...
|
|
virtual size_t | size () |
| Get the sizeof the directory. More...
|
|
Dir class.
Definition at line 31 of file Dir.h.
◆ Dir() [1/2]
Create an uninitialized directory.
Must call open to initialize the directory on a file system
◆ Dir() [2/2]
Open a directory on a filesystem.
- Parameters
-
fs | Filesystem as target for a directory |
path | Name of the directory to open |
◆ ~Dir()
Destroy a file.
Closes file if the file is still open
◆ open()
virtual int open |
( |
FileSystem * |
fs, |
|
|
const char * |
path |
|
) |
| |
|
virtual |
Open a directory on the filesystem.
- Parameters
-
fs | Filesystem as target for a directory |
path | Name of the directory to open |
- Returns
- 0 on success, negative error code on failure
◆ close()
Close a directory.
- Returns
- 0 on success, negative error code on failure
Implements DirHandle.
◆ read()
virtual ssize_t read |
( |
struct dirent * |
ent | ) |
|
|
virtual |
Read the next directory entry.
- Parameters
-
ent | The directory entry to fill out |
- Returns
- 1 on reading a filename, 0 at end of directory, negative error on failure
Implements DirHandle.
◆ seek()
virtual void seek |
( |
off_t |
offset | ) |
|
|
virtual |
Set the current position of the directory.
- Parameters
-
offset | Offset of the location to seek to, must be a value returned from tell |
Implements DirHandle.
◆ tell()
Get the current position of the directory.
- Returns
- Position of the directory that can be passed to rewind
Implements DirHandle.
◆ rewind()
Rewind the current position to the beginning of the directory.
Implements DirHandle.
◆ size()
Get the sizeof the directory.
- Returns
- Number of files in the directory
Reimplemented from DirHandle.