aboutsummaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
new file mode 100644
index 0000000..beb4b08
--- /dev/null
+++ b/src/buffer.h
@@ -0,0 +1,33 @@
1#ifndef BU_BUFFER_H
2#define BU_BUFFER_H
3
4#include "bu/filter.h"
5
6namespace Bu
7{
8 class Buffer : public Bu::Filter
9 {
10 public:
11 Buffer( Bu::Stream &rNext, int iBufSize=4096 );
12 virtual ~Buffer();
13
14 virtual void start();
15 virtual size_t stop();
16
17 virtual size_t read( void *pBuf, size_t nBytes );
18 virtual size_t write( const void *pBuf, size_t nBytes );
19 using Stream::write;
20
21 virtual void flush();
22
23 private:
24 size_t sSoFar;
25 int iBufSize;
26 char *sReadBuf;
27 char *sWriteBuf;
28 int iReadBufFill;
29 int iWriteBufFill;
30 };
31};
32
33#endif