Container for a contiguous byte buffer.
More...
#include <a3d/Buffer.h>
|
| | Buffer (const std::filesystem::path &path) |
| | Reads the complete contents of path into a Buffer. More...
|
| |
| | Buffer (const std::vector< std::byte > &buf) |
| | Creates a Buffer by copying the bytes in buf. More...
|
| |
| | Buffer (const std::byte *buf, std::size_t size) |
| | Creates a Buffer containing size bytes copied from buf. More...
|
| |
| | Buffer (std::size_t size) |
| | Creates a Buffer with storage for size bytes. More...
|
| |
| std::byte * | data () const |
| | Returns a mutable pointer to the owned bytes, or nullptr when the Buffer is empty. More...
|
| |
| std::size_t | size () const |
| | Returns the buffer size in bytes. More...
|
| |
| std::byte * | operator* () const |
| | Returns a mutable pointer to the owned bytes, equivalent to data(). More...
|
| |
| std::byte | operator[] (std::size_t idx) const |
| | Returns the byte at idx without bounds checking. More...
|
| |
Container for a contiguous byte buffer.
Copying a Buffer deep-copies its bytes; moving transfers the owned storage.
Definition at line 23 of file Buffer.h.
◆ Buffer() [1/4]
| a3d::Buffer::Buffer |
( |
const std::filesystem::path & |
path | ) |
|
|
explicit |
Reads the complete contents of path into a Buffer.
- Exceptions
-
| std::runtime_error | if the file cannot be opened, sized, or read. |
◆ Buffer() [2/4]
| a3d::Buffer::Buffer |
( |
const std::vector< std::byte > & |
buf | ) |
|
|
explicit |
Creates a Buffer by copying the bytes in buf.
◆ Buffer() [3/4]
| a3d::Buffer::Buffer |
( |
const std::byte * |
buf, |
|
|
std::size_t |
size |
|
) |
| |
Creates a Buffer containing size bytes copied from buf.
◆ Buffer() [4/4]
| a3d::Buffer::Buffer |
( |
std::size_t |
size | ) |
|
|
explicit |
Creates a Buffer with storage for size bytes.
◆ data()
| std::byte * a3d::Buffer::data |
( |
| ) |
const |
Returns a mutable pointer to the owned bytes, or nullptr when the Buffer is empty.
◆ operator*()
| std::byte * a3d::Buffer::operator* |
( |
| ) |
const |
Returns a mutable pointer to the owned bytes, equivalent to data().
◆ operator[]()
| std::byte a3d::Buffer::operator[] |
( |
std::size_t |
idx | ) |
const |
Returns the byte at idx without bounds checking.
- Parameters
-
| idx | valid zero-based byte index. |
◆ size()
| std::size_t a3d::Buffer::size |
( |
| ) |
const |
Returns the buffer size in bytes.
The documentation for this class was generated from the following file: