65 std::memcpy(
_ptr, dataPtr, dataSize);
84 const size_t oldPos =
_pos;
97 _data(0, disposeMemory), _ptr(0), _capacity(0), _size(0) {
116 const size_t oldPos =
pos();
134 std::memcpy(
_ptr, dataPtr, dataSize);
167 const size_t oldPos =
pos();
static size_t evalSeek(ptrdiff_t offset, Origin whence, size_t pos, size_t begin, size_t size)
Evaluate the seek offset relative to whence into a position from the beginning.
size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)
Seek offset bytes from the origin whence.
MemoryWriteStreamDynamic(bool disposeMemory=false, size_t capacity=0)
size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)
Seek offset bytes from the origin whence.
DisposableArray< byte > _data
size_t size() const
Return the number of bytes written to this stream in total.
Implementing the writing stream interfaces for memory blocks.
Low-level type definitions to handle fixed width types portably.
~MemoryWriteStreamDynamic()
void setDisposable(bool disposeMemory)
size_t write(const void *dataPtr, size_t dataSize)
Write data into the stream.
void reset(PointerType o=0)
Resets the pointer with the new value.
size_t size() const
Return the total size of the memory block.
void ensureCapacity(size_t newLen)
size_t write(const void *dataPtr, size_t dataSize)
Write data into the stream.
void setDisposable(bool d)
Change the disposable flag.
const Exception kSeekError("Seek error")
Exception when seeking a stream failed.
Origin
The position a seeking offset takes as a base.
PointerType get() const
Returns the plain pointer value.
size_t pos() const
Return the current writing position within the stream.
size_t pos() const
Return the current writing position within the memory block.
void dispose()
Unconditionally dispose of the pointer, destroying the old object.