42#ifndef UFO_IO_FILE_HANDLER_HPP
43#define UFO_IO_FILE_HANDLER_HPP
87 FileHandler(std::filesystem::path
const& file, std::string_view modes);
118 void open(std::filesystem::path
const& file, std::string_view modes);
125 void close() noexcept;
132 [[nodiscard]]
std::FILE*
get() const noexcept;
149 [[nodiscard]] explicit operator
bool() const noexcept;
152 std::FILE* fp_ =
nullptr;
RAII wrapper around a C std::FILE* handle.
std::FILE * get() const noexcept
Returns the underlying FILE*.
FileHandler(FileHandler const &)=delete
Copying a FILE* handle has no meaningful semantics.
static constexpr std::size_t buffer_size
Maximum number of characters (including the null terminator) read by readline().
void open(std::filesystem::path const &file, std::string_view modes)
Closes any currently open file, then opens file in modes.
char * readline()
Reads one line from the file into the internal buffer.
void close() noexcept
Closes the managed file handle and resets the pointer to null.
FileHandler()=default
Constructs an empty (closed) file handler.
~FileHandler()
Closes the managed file handle (if open).
All vision-related classes and functions.