RAII wrapper around an oveRTOS directory handle.
More...
#include <fs.hpp>
|
|
| Dir () |
| | Constructs a Dir object with no open directory (invalid state).
|
| |
|
| ~Dir () noexcept |
| | 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.
|
| |
| Result< void > | open (const char *path) noexcept |
| | Opens a directory at the specified path.
|
| |
| void | close () noexcept |
| | Closes the directory and invalidates the handle.
|
| |
| Result< bool > | readdir (struct ove_dirent *entry) noexcept |
| | 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()
| Result< void > ove::Dir::open |
( |
const char * |
path | ) |
|
|
inlinenoexcept |
Opens a directory at the specified path.
- Parameters
-
| [in] | path | Absolute path to the directory. |
- Returns
- Empty
Result<void> on success; unexpected Error on failure.
◆ close()
Closes the directory and invalidates the handle.
Safe to call on an already-closed directory (no-op). Matches File::close — backend errors are discarded.
◆ readdir()
| Result< bool > ove::Dir::readdir |
( |
struct ove_dirent * |
entry | ) |
|
|
inlinenoexcept |
Reads the next entry from the directory.
- Parameters
-
| [out] | entry | Pointer to a dirent struct to receive the entry data. |
- Returns
true if an entry was read into entry; false at end-of-directory. On error, returns unexpected with the corresponding Error variant.
◆ 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: