summaryrefslogtreecommitdiff
path: root/src/membuf.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/membuf.h')
-rw-r--r--src/membuf.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/membuf.h b/src/membuf.h
new file mode 100644
index 0000000..2cbbbdc
--- /dev/null
+++ b/src/membuf.h
@@ -0,0 +1,43 @@
1#ifndef MEM_BUF_H
2#define MEM_BUF_H
3
4#include <stdint.h>
5
6#include "bu/stream.h"
7
8namespace Bu
9{
10 /**
11 * A memory buffer stream.
12 */
13 class MemBuf : public Stream
14 {
15 public:
16 MemBuf();
17 virtual ~MemBuf();
18
19 virtual void close();
20 virtual size_t read( void *pBuf, size_t nBytes );
21 virtual size_t write( const void *pBuf, size_t nBytes );
22 virtual long tell();
23 virtual void seek( long offset );
24 virtual void setPos( long pos );
25 virtual void setPosEnd( long pos );
26 virtual bool isEOS();
27 virtual bool isOpen();
28 virtual void flush();
29 virtual bool canRead();
30 virtual bool canWrite();
31 virtual bool isReadable();
32 virtual bool isWritable();
33 virtual bool isSeekable();
34 virtual bool isBlocking();
35 virtual void setBlocking( bool bBlocking=true );
36
37 private:
38 Bu::FString sBuf;
39 long nPos;
40 };
41}
42
43#endif