diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
commit | ac517a2b7625e0aa0862679e961c6349f859ea3b (patch) | |
tree | e3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/membuf.h | |
parent | f8d4301e9fa4f3709258505941e37fab2eadadc6 (diff) | |
parent | bd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff) | |
download | libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2 libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip |
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to 'src/membuf.h')
-rw-r--r-- | src/membuf.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/membuf.h b/src/membuf.h new file mode 100644 index 0000000..8f53d4b --- /dev/null +++ b/src/membuf.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef BU_MEM_BUF_H | ||
2 | #define BU_MEM_BUF_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | |||
6 | #include "bu/stream.h" | ||
7 | #include "bu/fstring.h" | ||
8 | |||
9 | namespace Bu | ||
10 | { | ||
11 | /** | ||
12 | * A memory buffer stream. | ||
13 | */ | ||
14 | class MemBuf : public Stream | ||
15 | { | ||
16 | public: | ||
17 | MemBuf(); | ||
18 | MemBuf( const Bu::FString &str ); | ||
19 | virtual ~MemBuf(); | ||
20 | |||
21 | virtual void close(); | ||
22 | virtual size_t read( void *pBuf, size_t nBytes ); | ||
23 | |||
24 | /** | ||
25 | *@todo Allow writes at the current position, not just appending to | ||
26 | * the current buffer. This is a silly way to do it, but it covers all | ||
27 | * of our bases for now. | ||
28 | */ | ||
29 | virtual size_t write( const void *pBuf, size_t nBytes ); | ||
30 | virtual long tell(); | ||
31 | virtual void seek( long offset ); | ||
32 | virtual void setPos( long pos ); | ||
33 | virtual void setPosEnd( long pos ); | ||
34 | virtual bool isEOS(); | ||
35 | virtual bool isOpen(); | ||
36 | virtual void flush(); | ||
37 | virtual bool canRead(); | ||
38 | virtual bool canWrite(); | ||
39 | virtual bool isReadable(); | ||
40 | virtual bool isWritable(); | ||
41 | virtual bool isSeekable(); | ||
42 | virtual bool isBlocking(); | ||
43 | virtual void setBlocking( bool bBlocking=true ); | ||
44 | |||
45 | Bu::FString &getString(); | ||
46 | |||
47 | private: | ||
48 | Bu::FString sBuf; | ||
49 | long nPos; | ||
50 | }; | ||
51 | } | ||
52 | |||
53 | #endif | ||