bsa::components::compressed_byte_container class

A byte storage container with compression support.

Base classes

class basic_byte_container
A basic byte storage container.

Derived classes

class bsa::fo4::chunk final
Represents a chunk of a file within the FO4 virtual filesystem.
class bsa::tes4::file final
Represents a file within the TES4 virtual filesystem.

Capacity

auto empty() const -> bool noexcept
Checks if the underlying byte container is empty.
auto size() const -> std::size_t noexcept
Returns the size of the underlying byte container.

Decompression

auto decompressed_size() const -> std::size_t noexcept
Retrieves the decompressed size of the compressed storage.

Element access

auto as_bytes() const -> std::span<const std::byte> noexcept
Retrieves an immutable view into the underlying bytes.
auto data() const -> const std::byte* noexcept
Retrieves an immutable pointer to the underlying bytes.

Modifiers

void set_data(std::span<const std::byte> a_data, std::optional<std::size_t> a_decompressedSize = std::nullopt) noexcept
Assigns the underlying container to be a non-owning view into the given data.
void set_data(std::vector<std::byte> a_data, std::optional<std::size_t> a_decompressedSize = std::nullopt) noexcept
Assigns the underlying container to be an owning view into the given data.

Observers

auto compressed() const -> bool noexcept
Checks if the underlying bytes are compressed.

Function documentation

std::size_t bsa::components::compressed_byte_container::decompressed_size() const noexcept

Retrieves the decompressed size of the compressed storage.

Only valid if the container is compressed.

void bsa::components::compressed_byte_container::set_data(std::span<const std::byte> a_data, std::optional<std::size_t> a_decompressedSize = std::nullopt) noexcept

Assigns the underlying container to be a non-owning view into the given data.

Parameters
a_data The data to store a view to.
a_decompressedSize The decompressed size of the data, if the given data is compressed.

void bsa::components::compressed_byte_container::set_data(std::vector<std::byte> a_data, std::optional<std::size_t> a_decompressedSize = std::nullopt) noexcept

Assigns the underlying container to be an owning view into the given data.

Parameters
a_data The data to take ownership of.
a_decompressedSize The decompressed size of the data, if the given data is compressed.