RAII wrapper around an oveRTOS directory handle.
More...
#include <fs.hpp>
|
|
| Dir () |
| | Constructs a Dir object with no open directory (invalid state).
|
| |
|
| ~Dir () |
| | Destroys the Dir object, closing the directory if it is still open.
|
| |
|
| Dir (const Dir &)=delete |
| |
|
Dir & | operator= (const Dir &)=delete |
| |
| | Dir (Dir &&other) noexcept |
| | Move constructor — transfers ownership of the directory handle.
|
| |
| Dir & | operator= (Dir &&other) noexcept |
| | Move-assignment operator — closes the current directory and takes ownership.
|
| |
| int | open (const char *path) |
| | Opens a directory at the specified path.
|
| |
| int | close () |
| | Closes the directory and invalidates the handle.
|
| |
| int | readdir (struct ove_dirent *entry) |
| | Reads the next entry from the directory.
|
| |
| bool | valid () const |
| | Returns true if the directory handle is valid.
|
| |
| ove_dir_t | handle () const |
| | Returns the raw oveRTOS directory handle.
|
| |
RAII wrapper around an oveRTOS directory handle.
The directory is opened explicitly via open() and closed either by calling close() or automatically by the destructor.
- Note
- Non-copyable; movable.
◆ Dir()
| ove::Dir::Dir |
( |
Dir && |
other | ) |
|
|
inlinenoexcept |
Move constructor — transfers ownership of the directory handle.
- Parameters
-
| other | The source; its handle is set to null after the move. |
◆ operator=()
| Dir & ove::Dir::operator= |
( |
Dir && |
other | ) |
|
|
inlinenoexcept |
Move-assignment operator — closes the current directory and takes ownership.
- Parameters
-
| other | The source; its handle is set to null after the move. |
- Returns
- Reference to this object.
◆ open()
| int ove::Dir::open |
( |
const char * |
path | ) |
|
|
inline |
Opens a directory at the specified path.
- Parameters
-
| [in] | path | Absolute path to the directory. |
- Returns
OVE_OK on success, or a negative error code.
◆ close()
Closes the directory and invalidates the handle.
Safe to call on an already-closed directory (returns OVE_OK).
- Returns
OVE_OK on success, or a negative error code.
◆ readdir()
| int ove::Dir::readdir |
( |
struct ove_dirent * |
entry | ) |
|
|
inline |
Reads the next entry from the directory.
- Parameters
-
| [out] | entry | Pointer to a dirent struct to receive the entry data. |
- Returns
OVE_OK on success, a positive value at end-of-directory, or a negative error code on failure.
◆ valid()
| bool ove::Dir::valid |
( |
| ) |
const |
|
inline |
Returns true if the directory handle is valid.
- Returns
true when a directory has been successfully opened.
◆ handle()
| ove_dir_t ove::Dir::handle |
( |
| ) |
const |
|
inline |
Returns the raw oveRTOS directory handle.
- Returns
- The opaque
ove_dir_t handle.
The documentation for this class was generated from the following file: