21 #ifndef INCLUDE_OLA_IO_MEMORYBUFFER_H_
22 #define INCLUDE_OLA_IO_MEMORYBUFFER_H_
24 #include <ola/io/InputBuffer.h>
39 explicit MemoryBuffer(
const uint8_t *data,
unsigned int size)
46 unsigned int Read(uint8_t *data,
unsigned int length) {
47 unsigned int data_size = std::min(m_size - m_cursor, length);
48 memcpy(data, m_data + m_cursor, data_size);
49 m_cursor += data_size;
53 unsigned int Read(std::string *output,
unsigned int length) {
54 unsigned int data_size = std::min(m_size - m_cursor, length);
55 output->append(reinterpret_cast<const char*>(m_data + m_cursor),
57 m_cursor += data_size;
62 const uint8_t *m_data;
63 const unsigned int m_size;
64 unsigned int m_cursor;
66 MemoryBuffer(
const MemoryBuffer&);
67 MemoryBuffer& operator=(
const MemoryBuffer&);
71 #endif // INCLUDE_OLA_IO_MEMORYBUFFER_H_