class final
#include <bsa/tes3.hpp>
file Represents a file within the TES3 virtual filesystem.
Base classes
- class bsa::components::byte_container
- A byte storage container without compression support.
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.
Doxygen only
- void doxygen_read() protected
- Reads the contents of the source.
- void doxygen_write() const protected
Element access
Member types
-
using key = components::
key<hashing:: hash, hashing:: hash_file_in_place> - The key used to indentify a file.
Modifiers
- void clear() noexcept
- Clears the contents of the file.
-
void set_data(std::
span<const std:: byte> a_data) noexcept - Assigns the underlying container to be a non-owning view into the given data.
-
void set_data(std::
vector<std:: byte> a_data) noexcept - Assigns the underlying container to be an owning view into the given data.
Reading
-
void read(std::
filesystem:: path a_path) - Reads the contents of the source.
-
void read(std::
span<const std:: byte> a_src, copy_ type a_copy = copy_type:: deep) - Reads the contents of the source.
Writing
-
void write(std::
filesystem:: path a_path) const - void write(binary_io::any_ostream& a_dst) const
Function documentation
bool bsa:: tes3:: file:: empty() const noexcept
#include <bsa/detail/common.hpp>
Checks if the underlying byte container is empty.
std:: size_t bsa:: tes3:: file:: size() const noexcept
#include <bsa/detail/common.hpp>
Returns the size of the underlying byte container.
void bsa:: tes3:: file:: doxygen_read() protected
Reads the contents of the source.
Exceptions | |
---|---|
binary_io::buffer_exhausted | Thrown when reads index out of bounds. |
std:: span<const std:: byte> bsa:: tes3:: file:: as_bytes() const noexcept
#include <bsa/detail/common.hpp>
Retrieves an immutable view into the underlying bytes.
const std:: byte* bsa:: tes3:: file:: data() const noexcept
#include <bsa/detail/common.hpp>
Retrieves an immutable pointer to the underlying bytes.
void bsa:: tes3:: file:: set_data(std:: span<const std:: byte> a_data) noexcept
#include <bsa/detail/common.hpp>
Assigns the underlying container to be a non-owning view into the given data.
Parameters | |
---|---|
a_data | The data to store a view to. |
void bsa:: tes3:: file:: set_data(std:: vector<std:: byte> a_data) noexcept
#include <bsa/detail/common.hpp>
Assigns the underlying container to be an owning view into the given data.
Parameters | |
---|---|
a_data | The data to take ownership of. |
void bsa:: tes3:: file:: read(std:: filesystem:: path a_path)
Reads the contents of the source.
Parameters | |
---|---|
a_path | The path to the given archive on the native filesystem. |
Exceptions | |
binary_io::buffer_exhausted | Thrown when reads index out of bounds. |
std:: |
Thrown when filesystem errors are encountered. |
void bsa:: tes3:: file:: read(std:: span<const std:: byte> a_src,
copy_ type a_copy = copy_type:: deep)
Reads the contents of the source.
Parameters | |
---|---|
a_src | The source to read from. |
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:: tes3:: file:: write(std:: filesystem:: path a_path) const
Parameters | |
---|---|
a_path | The path to write the archive to on the native filesystem. |
void bsa:: tes3:: file:: write(binary_io::any_ostream& a_dst) const
Parameters | |
---|---|
a_dst | The stream to write the archive to. |