2001-10-06 14:13:28 +00:00
|
|
|
#ifndef CSTREAMBUFFER_H
|
|
|
|
#define CSTREAMBUFFER_H
|
|
|
|
|
|
|
|
#include "BasicTypes.h"
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class CStreamBuffer {
|
|
|
|
public:
|
|
|
|
CStreamBuffer();
|
|
|
|
~CStreamBuffer();
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
|
|
|
// peek() returns a buffer of n bytes (which must be <= getSize()).
|
|
|
|
// pop() discards the next n bytes.
|
2001-10-14 16:58:01 +00:00
|
|
|
const void* peek(UInt32 n);
|
|
|
|
void pop(UInt32 n);
|
2001-10-06 14:13:28 +00:00
|
|
|
|
|
|
|
// write() appends n bytes to the buffer
|
2001-10-14 16:58:01 +00:00
|
|
|
void write(const void*, UInt32 n);
|
2001-10-06 14:13:28 +00:00
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
// return the number of bytes in the buffer
|
2001-10-14 16:58:01 +00:00
|
|
|
UInt32 getSize() const;
|
2001-10-06 14:13:28 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const UInt32 kChunkSize;
|
|
|
|
|
|
|
|
typedef std::vector<UInt8> Chunk;
|
|
|
|
typedef std::list<Chunk> ChunkList;
|
|
|
|
|
|
|
|
ChunkList m_chunks;
|
|
|
|
UInt32 m_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|