oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::Dir Class Reference

RAII wrapper around an oveRTOS directory handle. More...

#include <fs.hpp>

Public Member Functions

 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
 
Diroperator= (const Dir &)=delete
 
 Dir (Dir &&other) noexcept
 Move constructor — transfers ownership of the directory handle.
 
Diroperator= (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Dir()

ove::Dir::Dir ( Dir &&  other)
inlinenoexcept

Move constructor — transfers ownership of the directory handle.

Parameters
otherThe source; its handle is set to null after the move.

Member Function Documentation

◆ operator=()

Dir & ove::Dir::operator= ( Dir &&  other)
inlinenoexcept

Move-assignment operator — closes the current directory and takes ownership.

Parameters
otherThe 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]pathAbsolute path to the directory.
Returns
Empty Result<void> on success; unexpected Error on failure.

◆ close()

void ove::Dir::close ( )
inlinenoexcept

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]entryPointer 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: