diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2009-02-24 01:31:48 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2009-02-24 01:31:48 +0000 |
| commit | 22277c6ffe91189cbb5d7a7d8572bf829e3a2610 (patch) | |
| tree | 5e9d2a7aa1e1d2c2efe8696ff174d125de6051a4 /src/buffer.h | |
| parent | 88b3a5acf78aa9a2d73f2462e45988f5afb9d2c5 (diff) | |
| download | libbu++-22277c6ffe91189cbb5d7a7d8572bf829e3a2610.tar.gz libbu++-22277c6ffe91189cbb5d7a7d8572bf829e3a2610.tar.bz2 libbu++-22277c6ffe91189cbb5d7a7d8572bf829e3a2610.tar.xz libbu++-22277c6ffe91189cbb5d7a7d8572bf829e3a2610.zip | |
Just committing some in-progress code. It may report some warnings, but it
doesn't inhibit building. These'll be in good working shape in no time.
Diffstat (limited to '')
| -rw-r--r-- | src/buffer.h | 33 |
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 | |||
| 6 | namespace 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 | ||
