31 #ifndef SERUT_VECTORSERIALIZER_H
33 #define SERUT_VECTORSERIALIZER_H
35 #include "serutconfig.h"
53 bool readBytes(
void *pBuffer,
size_t amount);
54 bool writeBytes(
const void *pBuffer,
size_t amount);
57 const std::vector<uint8_t> &
getBuffer()
const {
return m_bytes; }
60 const unsigned char *
getBufferPointer() {
return static_cast<const unsigned char *
>(&m_bytes[0]); }
66 std::vector<uint8_t> m_bytes;
Generic serialization interface.
Definition: serializationinterface.h:58
A serializer which uses an STL vector, which can grow in size.
Definition: vectorserializer.h:44
const std::vector< uint8_t > & getBuffer() const
Returns the vector instance that's being used for reading and writing.
Definition: vectorserializer.h:57
const unsigned char * getBufferPointer()
Returns a pointer to the first element of the internal buffer (do not use if no data is available!...
Definition: vectorserializer.h:60
VectorSerializer()
Construct an instance with no predefined data - what you read is only what you've written.
VectorSerializer(const std::vector< uint8_t > &initialBuffer)
Construct an instance which will copy the specified initial data - new writes will append,...
int getBufferSize() const
Returns the current size of the internal buffer.
Definition: vectorserializer.h:63