diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-07-30 17:05:47 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-07-30 17:05:47 +0000 |
commit | 3f0f30442de297859cccc18f28db83b4e755d36f (patch) | |
tree | 6e9fdd9ff6febcdd87779f7663fecc0388e0dd73 /src/buffer.h | |
parent | 8551cdd3bbf66d8b7b0fea8aa1e0fbddd86bca47 (diff) | |
download | libbu++-3f0f30442de297859cccc18f28db83b4e755d36f.tar.gz libbu++-3f0f30442de297859cccc18f28db83b4e755d36f.tar.bz2 libbu++-3f0f30442de297859cccc18f28db83b4e755d36f.tar.xz libbu++-3f0f30442de297859cccc18f28db83b4e755d36f.zip |
Bu::Buffer actually works, and works really well. I dig it. Bu::BZip2 now
follows the new filter guidelines, where read and write report the amount of
data consumed, not the amount processed. I.e. when writing, it reports how
much of your incoming data it used, not how many bytes it wrote on the other
end.
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h index beb4b08..a18be11 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
@@ -1,3 +1,10 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2008 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
1 | #ifndef BU_BUFFER_H | 8 | #ifndef BU_BUFFER_H |
2 | #define BU_BUFFER_H | 9 | #define BU_BUFFER_H |
3 | 10 | ||
@@ -18,15 +25,23 @@ namespace Bu | |||
18 | virtual size_t write( const void *pBuf, size_t nBytes ); | 25 | virtual size_t write( const void *pBuf, size_t nBytes ); |
19 | using Stream::write; | 26 | using Stream::write; |
20 | 27 | ||
28 | size_t getReadFill() { return iReadBufFill; } | ||
29 | bool isWritePending() { return iWriteBufFill > 0; } | ||
30 | |||
21 | virtual void flush(); | 31 | virtual void flush(); |
22 | 32 | ||
23 | private: | 33 | private: |
34 | void fillReadBuf(); | ||
35 | |||
36 | private: | ||
24 | size_t sSoFar; | 37 | size_t sSoFar; |
25 | int iBufSize; | 38 | int iBufSize; |
26 | char *sReadBuf; | 39 | char *sReadBuf; |
27 | char *sWriteBuf; | 40 | char *sWriteBuf; |
28 | int iReadBufFill; | 41 | int iReadBufFill; |
42 | int iReadPos; | ||
29 | int iWriteBufFill; | 43 | int iWriteBufFill; |
44 | int iWritePos; | ||
30 | }; | 45 | }; |
31 | }; | 46 | }; |
32 | 47 | ||