The OpenD Programming Language

MemoryFile

This is basically an owned buffer, with capacity, optionally borrowed. The original things being that it can both be used for reading and writing.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

initEmpty
void initEmpty()

Initialize empty buffer for writing. Must be a T.init object.

initFromExistingSlice
void initFromExistingSlice(const(ubyte)[] arr)

Initialize buffer as reading a slice. Must be a T.init object.

releaseData
ubyte[] releaseData()

Return internal data pointer (allocated with malloc/free) stream doesn't own it anymore, the caller does instead. Can only be called if that buffer is owned is the first place.

Variables

bytes
size_t bytes;

Length of buffer.

capacity
size_t capacity;

Size of the underlying allocation, meaningful if owned.

data
ubyte* data;

Pointer to data (owned or borrowed). if owned, the buffer is guaranteed to be allocated with malloc/free/realloc.

offset
size_t offset;

Current pointer in the buffer.

owned
bool owned;

If the memory is owned by MemoryFile, or borrowed.

readOnly
bool readOnly;

If can only read from buffer.

Meta