binary_io::components::file_stream_base class

Implements the common interface of every file_stream.

Derived classes

class binary_io::file_istream final
A stream which composes a file handle.
class binary_io::file_ostream final
A stream which composes a file handle.

Constructors, destructors, conversion operators

file_stream_base() defaulted noexcept
file_stream_base(const file_stream_base&) deleted
file_stream_base(file_stream_base&&) defaulted noexcept
~file_stream_base() defaulted noexcept

Public functions

auto operator=(const file_stream_base&) -> file_stream_base& deleted
auto operator=(file_stream_base&&) -> file_stream_base& defaulted noexcept

Buffer management

auto rdbuf() -> std::FILE* noexcept
Provides mutable access to the underlying buffer.
auto rdbuf() const -> const std::FILE* noexcept
Provides immutable access to the underlying buffer.

Buffering

void flush() noexcept
Flushes the underlying file buffer.

File operations

void close() noexcept
Closes the stream's file handle, if applicable.
auto is_open() const -> bool noexcept
Checks if the stream has an open file handle.

Position

void seek_absolute(binary_io::streamoff a_pos) noexcept
Seek to an absolute position in the stream (i.e. from the beginning).
void seek_relative(binary_io::streamoff a_off) noexcept
Seek to a position in the stream relative to the current position.
auto tell() const -> binary_io::streamoff noexcept
Gets the current stream position.

Function documentation

std::FILE* binary_io::components::file_stream_base::rdbuf() noexcept

Provides mutable access to the underlying buffer.

Returns The underlying buffer.

const std::FILE* binary_io::components::file_stream_base::rdbuf() const noexcept

Provides immutable access to the underlying buffer.

Returns The underlying buffer.

void binary_io::components::file_stream_base::close() noexcept

Closes the stream's file handle, if applicable.

bool binary_io::components::file_stream_base::is_open() const noexcept

Checks if the stream has an open file handle.

Returns true if the stream has an open file handle, false otherwise.

void binary_io::components::file_stream_base::seek_absolute(binary_io::streamoff a_pos) noexcept

Seek to an absolute position in the stream (i.e. from the beginning).

Parameters
a_pos The absolute position to seek to.

void binary_io::components::file_stream_base::seek_relative(binary_io::streamoff a_off) noexcept

Seek to a position in the stream relative to the current position.

Parameters
a_off The offset to seek to.

binary_io::streamoff binary_io::components::file_stream_base::tell() const noexcept

Gets the current stream position.

Returns The current stream position.