39 unsigned char* m_memory;
41 unsigned int m_totalSize;
85 void writeData(
const void* data,
unsigned int size);
123 unsigned int readData(
void* data,
unsigned int size);
void writeString(const std::string &s)
Append a UTF-8/narrow string with its character count prefix.
void writeShort(short data)
Append a signed 16-bit integer.
unsigned int getTotalSize()
Get the total allocated capacity.
Definition CMemoryStream.h:181
unsigned int getSize()
Get the number of bytes written or available for reading.
Definition CMemoryStream.h:163
unsigned short readUShort()
Read an unsigned 16-bit integer and advance the read position.
CMemoryStream(unsigned int initMem=512)
Create an owning memory stream.
char readChar()
Read a signed 8-bit character and advance the read position.
void writeFloat(float data)
Append a 32-bit floating-point value.
void writeChar(char data)
Append a signed 8-bit character.
double readDouble()
Read a 64-bit floating-point value and advance the read position.
void encrypt()
Encrypt the stream contents.
void decrypt()
Decrypt the stream contents.
void writeString(const std::wstring &s)
Append a wide string with its character count prefix.
void writeData(const void *data, unsigned int size)
Append raw bytes to the stream.
int readInt()
Read a signed 32-bit integer and advance the read position.
void writeDouble(double data)
Append a 64-bit floating-point value.
short readShort()
Read a signed 16-bit integer and advance the read position.
void setPos(unsigned int pos)
Set the current read position.
Definition CMemoryStream.h:190
void readFloatArray(float *f, int count)
Read an array of floats and advance the read position.
float readFloat()
Read a 32-bit floating-point value and advance the read position.
unsigned int readUInt()
Read an unsigned 32-bit integer and advance the read position.
void writeInt(int data)
Append a signed 32-bit integer.
std::string readString()
Read a narrow string written by writeString(const std::string&).
void writeStream(CMemoryStream *stream)
Append the full contents of another memory stream.
void writeUShort(unsigned short data)
Append an unsigned 16-bit integer.
bool autoGrow(unsigned int writeSize)
Ensure the stream has enough capacity for an upcoming write.
virtual ~CMemoryStream()
Destroy the stream and release owned memory.
void resetWrite()
Clear written data and reset the read position.
Definition CMemoryStream.h:198
unsigned int getPos()
Get the current read position.
Definition CMemoryStream.h:172
void writeFloatArray(const float *f, int count)
Append an array of floats.
void writeUInt(unsigned int data)
Append an unsigned 32-bit integer.
CMemoryStream(unsigned char *fromMem, unsigned int size)
Wrap an existing memory block for reading or fixed-size writing.
CMemoryStream(const CMemoryStream &stream)
Copy a stream into a new backing buffer.
std::wstring readWString()
Read a wide string written by writeString(const std::wstring&).
unsigned char * getData()
Get the backing memory pointer.
Definition CMemoryStream.h:154
unsigned int readData(void *data, unsigned int size)
Read raw bytes from the current read position.
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29