class final
#include <bsa/fo4.hpp>
file Represents a file within the FO4 virtual filesystem.
Public types
- struct header_t
- Unique to format::
directx. - struct read_params
- Common parameters to configure how files are read.
- struct write_params
- Common parameters to configure how files are written.
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
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(read_
source a_source, const read_ params& a_params) - Reads the contents of the source.
Writing
-
void write(write_
sink a_sink, const write_ params& a_params) const - Writes the contents of the object to the destination.
Function documentation
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(read_ source a_source,
const read_ params& a_params)
Reads the contents of the source.
Parameters | |
---|---|
a_source | Where/how to read the given file. |
a_params | Extra configuration options. |
Exceptions | |
binary_io::buffer_exhausted | Thrown when reads index out of bounds. |
void bsa:: fo4:: file:: write(write_ sink a_sink,
const write_ params& a_params) const
Writes the contents of the object to the destination.
Parameters | |
---|---|
a_sink | Where/how to write the given file. |
a_params | Extra configuration options. |
Exceptions | |
std:: |
Thrown when filesystem errors are encountered. |
binary_io::buffer_exhausted | Thrown when the output buffer is exhausted. |