mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-26 22:03:24 +08:00
Started over.
This commit is contained in:
38
net/CSocketStreamBuffer.h
Normal file
38
net/CSocketStreamBuffer.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef CSOCKETSTREAMBUFFER_H
|
||||
#define CSOCKETSTREAMBUFFER_H
|
||||
|
||||
#include "BasicTypes.h"
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
class CSocketStreamBuffer {
|
||||
public:
|
||||
CSocketStreamBuffer();
|
||||
~CSocketStreamBuffer();
|
||||
|
||||
// manipulators
|
||||
|
||||
// peek() returns a buffer of n bytes (which must be <= getSize()).
|
||||
// pop() discards the next n bytes.
|
||||
const void* peek(UInt32 n) throw();
|
||||
void pop(UInt32 n) throw();
|
||||
|
||||
// write() appends n bytes to the buffer
|
||||
void write(const void*, UInt32 n) throw();
|
||||
|
||||
// accessors
|
||||
|
||||
// return the number of bytes in the buffer
|
||||
UInt32 getSize() const throw();
|
||||
|
||||
private:
|
||||
static const UInt32 kChunkSize;
|
||||
|
||||
typedef std::vector<UInt8> Chunk;
|
||||
typedef std::list<Chunk> ChunkList;
|
||||
|
||||
ChunkList m_chunks;
|
||||
UInt32 m_size;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user