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 ()
 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.
 
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.
 

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()

int ove::Dir::open ( const char *  path)
inline

Opens a directory at the specified path.

Parameters
[in]pathAbsolute path to the directory.
Returns
OVE_OK on success, or a negative error code.

◆ close()

int ove::Dir::close ( )
inline

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