class final
#include <bsa/fo4.hpp>
file Represents a file within the FO4 virtual filesystem.
Public types
- struct header_t
- Unique to format::
directx.
Public variables
-
struct bsa::
fo4:: file:: header_t header
Assignment
Capacity
-
auto capacity() const -> std::
size_t noexcept - Returns the number of chunks the file can store without reallocating.
- auto empty() const -> bool noexcept
- Checks if the file is empty.
-
void reserve(std::
size_t a_count) noexcept - Reserves storage for
a_count
chunks. - void shrink_to_fit() noexcept
- Shrinks the file's capacity to its size.
-
auto size() const -> std::
size_t noexcept - Returns the number of chunks in the file.
Constructors
Destructors
- ~file() defaulted noexcept
Doxygen only
-
void doxygen_read(format a_format,
std::
size_t a_mipChunkWidth = 512u, std:: size_t a_mipChunkHeight = 512u, compression_ level a_level = compression_level:: normal, compression_ type a_compression = compression_type:: decompressed) protected - void doxygen_write(format a_format) const protected
Element access
-
auto back() -> value_
type& noexcept - Returns a reference to the chunk at the back of the file.
-
auto back() const -> const value_
type& noexcept - Returns a reference to the chunk at the back of the file.
-
auto front() -> value_
type& noexcept - Returns a reference to the chunk at the front of the file.
-
auto front() const -> const value_
type& noexcept - Returns a reference to the chunk at the front of the file.
-
auto operator[](std::
size_t a_pos) -> value_ type& noexcept - Returns the chunk at the given position.
-
auto operator[](std::
size_t a_pos) const -> const value_ type& noexcept - Returns the chunk at the given position.
Iterators
- auto begin() -> iterator noexcept
- Returns an iterator to the beginning of the file.
-
auto begin() const -> const_
iterator noexcept - Returns an iterator to the beginning of the file.
-
auto cbegin() const -> const_
iterator noexcept - Returns an iterator to the beginning of the file.
-
auto cend() const -> const_
iterator noexcept - Returns an iterator to the end of the file.
- auto end() -> iterator noexcept
- Returns an iterator to the end of the file.
-
auto end() const -> const_
iterator noexcept - Returns an iterator to the end of the file.
Member types
- using const_iterator = container_type::const_iterator
- using iterator = container_type::iterator
-
using key = components::
key<hashing:: hash, hashing:: hash_file_in_place> - The key used to indentify a file.
- using value_type = chunk
Modifiers
- void clear() noexcept
- Clears the chunks and header of the file.
-
template<class... Args>auto emplace_back(Args && ... a_args) -> value_
type& noexcept - Constructs a chunk in-place, inside the file.
- void pop_back() noexcept
- Removes a chunk from the file.
-
void push_back(value_
type a_value) noexcept - Appends a chunk to the file.
Reading
-
void read(std::
filesystem:: path a_path, format a_format, std:: size_t a_mipChunkWidth = 512u, std:: size_t a_mipChunkHeight = 512u, compression_ level a_level = compression_level:: normal, compression_ type a_compression = compression_type:: decompressed) - Reads the contents of the source.
-
void read(std::
span<const std:: byte> a_src, format a_format, std:: size_t a_mipChunkWidth = 512u, std:: size_t a_mipChunkHeight = 512u, compression_ level a_level = compression_level:: normal, compression_ type a_compression = compression_type:: decompressed, copy_ type a_copy = copy_type:: deep) - Reads the contents of the source.
Writing
-
void write(std::
filesystem:: path a_path, format a_format) const - void write(binary_io::any_ostream& a_dst, format a_format) const
Function documentation
void bsa:: fo4:: file:: doxygen_read(format a_format,
std:: size_t a_mipChunkWidth = 512u,
std:: size_t a_mipChunkHeight = 512u,
compression_ level a_level = compression_level:: normal,
compression_ type a_compression = compression_type:: decompressed) protected
Parameters | |
---|---|
a_format | The format to read the file as. |
a_mipChunkWidth | The maxiumum width to restrict a single mip chunk to. |
a_mipChunkHeight | The maxiumum height to restrict a single mip chunk to. |
a_level | The level to compress the data at. |
a_compression | The resulting compression of the file read. |
void bsa:: fo4:: file:: doxygen_write(format a_format) const protected
Parameters | |
---|---|
a_format | The format to write the file as. |
value_ type& bsa:: fo4:: file:: back() noexcept
Returns a reference to the chunk at the back of the file.
const value_ type& bsa:: fo4:: file:: back() const noexcept
Returns a reference to the chunk at the back of the file.
value_ type& bsa:: fo4:: file:: front() noexcept
Returns a reference to the chunk at the front of the file.
const value_ type& bsa:: fo4:: file:: front() const noexcept
Returns a reference to the chunk at the front of the file.
value_ type& bsa:: fo4:: file:: operator[](std:: size_t a_pos) noexcept
Returns the chunk at the given position.
const value_ type& bsa:: fo4:: file:: operator[](std:: size_t a_pos) const noexcept
Returns the chunk at the given position.
void bsa:: fo4:: file:: read(std:: filesystem:: path a_path,
format a_format,
std:: size_t a_mipChunkWidth = 512u,
std:: size_t a_mipChunkHeight = 512u,
compression_ level a_level = compression_level:: normal,
compression_ type a_compression = compression_type:: decompressed)
Reads the contents of the source.
Parameters | |
---|---|
a_path | The path to the given archive on the native filesystem. |
a_format | The format to read the file as. |
a_mipChunkWidth | The maxiumum width to restrict a single mip chunk to. |
a_mipChunkHeight | The maxiumum height to restrict a single mip chunk to. |
a_level | The level to compress the data at. |
a_compression | The resulting compression of the file read. |
Exceptions | |
binary_io::buffer_exhausted | Thrown when reads index out of bounds. |
std:: |
Thrown when filesystem errors are encountered. |
void bsa:: fo4:: file:: read(std:: span<const std:: byte> a_src,
format a_format,
std:: size_t a_mipChunkWidth = 512u,
std:: size_t a_mipChunkHeight = 512u,
compression_ level a_level = compression_level:: normal,
compression_ type a_compression = compression_type:: decompressed,
copy_ type a_copy = copy_type:: deep)
Reads the contents of the source.
Parameters | |
---|---|
a_src | The source to read from. |
a_format | The format to read the file as. |
a_mipChunkWidth | The maxiumum width to restrict a single mip chunk to. |
a_mipChunkHeight | The maxiumum height to restrict a single mip chunk to. |
a_level | The level to compress the data at. |
a_compression | The resulting compression of the file read. |
a_copy | The method to use when copying data from a_src . |
Exceptions | |
binary_io::buffer_exhausted | Thrown when reads index out of bounds. |
void bsa:: fo4:: file:: write(std:: filesystem:: path a_path,
format a_format) const
Parameters | |
---|---|
a_path | The path to write the archive to on the native filesystem. |
a_format | The format to write the file as. |
void bsa:: fo4:: file:: write(binary_io::any_ostream& a_dst,
format a_format) const
Parameters | |
---|---|
a_dst | The stream to write the archive to. |
a_format | The format to write the file as. |