IODevice backed by an in-memory Buffer.
Definition bufferiodevice.h:37
bool atEnd() const override
Returns true if the current position is at the end.
int64_t read(void *data, int64_t maxSize) override
Reads up to maxSize bytes into data.
BufferIODevice(Buffer *buffer, ObjectBase *parent=nullptr)
Constructs a BufferIODevice with an external Buffer.
bool isSequential() const override
Returns true if the device is sequential (non-seekable).
int64_t pos() const override
Returns the current read/write position.
Error seek(int64_t pos) override
Seeks to the given byte offset from the beginning.
~BufferIODevice() override
Destructor.
Buffer * buffer() const
Returns the underlying Buffer, or nullptr.
Definition bufferiodevice.h:72
int64_t bytesAvailable() const override
Returns the number of bytes available for reading.
bool isOpen() const override
Returns true if the device is open.
BufferIODevice(ObjectBase *parent=nullptr)
Constructs a BufferIODevice with no buffer.
void setBuffer(Buffer *buffer)
Sets the underlying Buffer.
int64_t write(const void *data, int64_t maxSize) override
Writes up to maxSize bytes from data.
Error open(OpenMode mode) override
Opens the device with the specified mode.
Result< int64_t > size() const override
Returns the total size of the device in bytes.
Error close() override
Closes the device.
Generic memory buffer descriptor with alignment and memory space support.
Definition buffer.h:85
Lightweight error code wrapper for the promeki library.
Definition error.h:39
Abstract base class for all I/O devices.
Definition iodevice.h:29
OpenMode
Mode flags controlling how a device is opened.
Definition iodevice.h:33
Dynamic array container wrapping std::vector.
Definition list.h:40
Base object for promeki.
Definition objectbase.h:129
ObjectBase * parent() const
Returns the parent object, if one. nullptr if none.
Definition objectbase.h:258
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19