Implements the pw::stream::Writer interface by backing the data destination with an externally provided memory buffer. pw::stream::MemoryWriterBuffer extends pw::stream::MemoryWriter to internally provide a memory buffer.
MemoryWriter can be accessed like a standard C++ container. The contents grow as data is written.
|
|
using | difference_type = ptrdiff_t |
| |
|
using | reference = const std::byte & |
| |
|
using | const_reference = const std::byte & |
| |
|
using | pointer = const std::byte * |
| |
|
using | const_pointer = const std::byte * |
| |
|
using | iterator = const std::byte * |
| |
|
using | const_iterator = const std::byte * |
| |
| enum | Whence : uint8_t { kBeginning = 0b001
, kCurrent = 0b010
, kEnd = 0b100
} |
| | Positions from which to seek. More...
|
| |
|
|
constexpr | MemoryWriter (ByteSpan dest) |
| |
|
constexpr | MemoryWriter (ByteSpan dest, size_t bytes_written) |
| |
|
ConstByteSpan | WrittenData () const |
| |
|
void | clear () |
| |
|
std::byte * | data () |
| |
|
const std::byte * | data () const |
| |
|
const std::byte & | operator[] (size_t index) const |
| |
|
bool | empty () const |
| |
|
size_t | size () const |
| |
|
size_t | bytes_written () const |
| |
|
size_t | capacity () const |
| |
|
const std::byte * | begin () const |
| |
|
const std::byte * | end () const |
| |
| constexpr bool | readable () const |
| |
| constexpr bool | writable () const |
| |
| constexpr bool | seekable () const |
| |
|
constexpr bool | seekable (Whence origin) const |
| | True if the stream supports seeking from the specified origin.
|
| |
| Result< ByteSpan > | Read (ByteSpan dest) |
| |
|
Result< ByteSpan > | Read (void *dest, size_t size_bytes) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
| |
| Result< ByteSpan > | ReadExact (ByteSpan const buffer) |
| |
| Status | Write (ConstByteSpan data) |
| |
|
Status | Write (const void *data, size_t size_bytes) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
| |
|
Status | Write (const std::byte b) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
| |
| Status | Seek (ptrdiff_t offset, Whence origin=kBeginning) |
| |
| size_t | Tell () |
| |
| size_t | ConservativeReadLimit () const |
| |
| size_t | ConservativeWriteLimit () const |
| |
|
|
static constexpr size_t | kUnlimited = std::numeric_limits<size_t>::max() |
| | Value returned from read/write limit if unlimited.
|
| |
|
static constexpr size_t | kUnknownPosition = std::numeric_limits<size_t>::max() |
| | Returned by Tell() if getting the position is not supported.
|
| |
| enum class | LimitType : bool { kRead
, kWrite
} |
| |
◆ ConservativeLimit()
| size_t pw::stream::MemoryWriter::ConservativeLimit |
( |
LimitType |
limit_type | ) |
const |
|
inlineoverrideprivatevirtual |
◆ DoSeek()
| Status pw::stream::MemoryWriter::DoSeek |
( |
ptrdiff_t |
offset, |
|
|
Whence |
origin |
|
) |
| |
|
inlinefinalprivatevirtual |
◆ DoTell()
| size_t pw::stream::MemoryWriter::DoTell |
( |
| ) |
|
|
inlinefinalprivatevirtual |
Virtual Tell() function optionally implemented by derived classes. The default implementation always returns kUnknownPosition.
Reimplemented from pw::stream::Stream.
◆ DoWrite()
The documentation for this class was generated from the following file: