Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
fs_utils.h File Reference

Inline helpers for reading and writing RegisterValue through IFileSystem. More...

#include <array>
#include <charconv>
#include <cstddef>
#include <span>
#include <string>
#include <string_view>
#include <system_error>
#include <vector>
#include "contur/core/error.h"
#include "contur/core/types.h"
#include "contur/fs/file_descriptor.h"
#include "contur/fs/i_filesystem.h"

Go to the source code of this file.

Namespaces

namespace  contur

Functions

Result< RegisterValuecontur::parseRegisterValue (std::string_view text) noexcept
 Parses a decimal integer string into a RegisterValue.
Result< RegisterValuecontur::readFileValue (IFileSystem &fs, const std::string &path)
 Reads a RegisterValue stored as decimal text from a file.
Result< void > contur::writeFileValue (IFileSystem &fs, const std::string &path, RegisterValue value)
 Writes a RegisterValue as decimal text to a file, truncating first.

Detailed Description

Inline helpers for reading and writing RegisterValue through IFileSystem.

Files store values as ASCII decimal strings. These utilities wrap the open/read/write/close sequence and handle text serialization so that callers do not have to deal with byte buffers or std::from_chars directly.

Definition in file fs_utils.h.