42[[nodiscard]]
inline Result<void> mount(
const char *dev_path,
const char *mount_point)
noexcept
44 return from_rc(ove_fs_mount(dev_path, mount_point));
51inline void unmount(
const char *mount_point)
53 ove_fs_unmount(mount_point);
64 return from_rc(ove_fs_unlink(path));
76 return from_rc(ove_fs_rename(old_path, new_path));
110 File &operator=(
const File &) =
delete;
116 File(
File &&other) noexcept : handle_(other.handle_)
118 other.handle_ =
nullptr;
128 if (
this != &other) {
130 handle_ = other.handle_;
131 other.handle_ =
nullptr;
145 return from_rc(ove_fs_open(&handle_, path, flags));
160 (void)ove_fs_close(handle_);
175 size_t bytes_read = 0;
176 const int rc = ove_fs_read(handle_, buf, count, &bytes_read);
177 return from_rc(rc, bytes_read);
189 size_t bytes_written = 0;
190 const int rc = ove_fs_write(handle_, buf, count, &bytes_written);
191 return from_rc(rc, bytes_written);
203 return from_rc(ove_fs_seek(handle_, offset, whence));
212 return ove_fs_tell(handle_);
223 const int rc = ove_fs_size(handle_, &out_size);
233 return handle_ !=
nullptr;
246 ove_file_t handle_ =
nullptr;
276 Dir(
const Dir &) =
delete;
277 Dir &operator=(
const Dir &) =
delete;
283 Dir(
Dir &&other) noexcept : handle_(other.handle_)
285 other.handle_ =
nullptr;
295 if (
this != &other) {
297 handle_ = other.handle_;
298 other.handle_ =
nullptr;
311 return from_rc(ove_fs_opendir(&handle_, path));
323 (void)ove_fs_closedir(handle_);
338 const int rc = ove_fs_readdir(handle_, entry);
341 if (rc == OVE_ERR_EOF)
343 return std::unexpected{
static_cast<Error>(rc)};
352 return handle_ !=
nullptr;
365 ove_dir_t handle_ =
nullptr;
RAII wrapper around an oveRTOS directory handle.
Definition fs.hpp:259
Result< bool > readdir(struct ove_dirent *entry) noexcept
Reads the next entry from the directory.
Definition fs.hpp:336
~Dir() noexcept
Destroys the Dir object, closing the directory if it is still open.
Definition fs.hpp:271
Dir & operator=(Dir &&other) noexcept
Move-assignment operator — closes the current directory and takes ownership.
Definition fs.hpp:293
Dir(Dir &&other) noexcept
Move constructor — transfers ownership of the directory handle.
Definition fs.hpp:283
ove_dir_t handle() const
Returns the raw oveRTOS directory handle.
Definition fs.hpp:359
void close() noexcept
Closes the directory and invalidates the handle.
Definition fs.hpp:320
bool valid() const
Returns true if the directory handle is valid.
Definition fs.hpp:350
Result< void > open(const char *path) noexcept
Opens a directory at the specified path.
Definition fs.hpp:309
Dir()
Constructs a Dir object with no open directory (invalid state).
Definition fs.hpp:264
RAII wrapper around an oveRTOS file handle.
Definition fs.hpp:92
long tell()
Returns the current file offset.
Definition fs.hpp:210
void close() noexcept
Closes the file and invalidates the handle.
Definition fs.hpp:157
Result< size_t > write(const void *buf, size_t count) noexcept
Writes bytes to the file at the current position.
Definition fs.hpp:187
bool valid() const
Returns true if the file handle is valid (file is open).
Definition fs.hpp:231
File()
Constructs a File object with no open file (invalid state).
Definition fs.hpp:97
Result< void > open(const char *path, int flags) noexcept
Opens a file at the specified path.
Definition fs.hpp:143
Result< size_t > size() noexcept
Returns the size of the file.
Definition fs.hpp:220
File & operator=(File &&other) noexcept
Move-assignment operator — closes the current file and takes ownership.
Definition fs.hpp:126
Result< size_t > read(void *buf, size_t count) noexcept
Reads bytes from the file at the current position.
Definition fs.hpp:173
~File() noexcept
Destroys the file object, closing the file if it is still open.
Definition fs.hpp:104
File(File &&other) noexcept
Move constructor — transfers ownership of the file handle.
Definition fs.hpp:116
ove_file_t handle() const
Returns the raw oveRTOS file handle.
Definition fs.hpp:240
Result< void > seek(long offset, int whence) noexcept
Repositions the file offset.
Definition fs.hpp:201
Strong ove::Error type, Result<T> alias, and std::error_code interop for the oveRTOS C++ binding.
void unmount(const char *mount_point)
Unmounts a previously mounted filesystem.
Definition fs.hpp:51
Result< void > mount(const char *dev_path, const char *mount_point) noexcept
Mounts a filesystem at the given mount point.
Definition fs.hpp:42
Result< void > unlink(const char *path) noexcept
Deletes a file from the filesystem.
Definition fs.hpp:62
Result< void > rename(const char *old_path, const char *new_path) noexcept
Renames or moves a file or directory.
Definition fs.hpp:74
Top-level namespace for all oveRTOS C++ abstractions.
Definition app.hpp:20
Result< void > from_rc(int rc) noexcept
Lifts a substrate rc-code into a Result<void>.
Definition error.hpp:254
Error
Strong-typed mirror of substrate OVE_ERR_* codes.
Definition error.hpp:64
std::expected< T, Error > Result
std::expected-based result alias.
Definition error.hpp:139
Common type definitions and concepts for the C++ wrapper layer.