diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2007-06-07 19:56:20 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2007-06-07 19:56:20 +0000 |
| commit | 9e8a4944e50fab432012878c66e1bdac20649f76 (patch) | |
| tree | 412b0d49ae4086bb330045f9956513397b866807 /src/bzip2.h | |
| parent | c2e3879b965d297604804f03271ac71c8c5c81f3 (diff) | |
| download | libbu++-9e8a4944e50fab432012878c66e1bdac20649f76.tar.gz libbu++-9e8a4944e50fab432012878c66e1bdac20649f76.tar.bz2 libbu++-9e8a4944e50fab432012878c66e1bdac20649f76.tar.xz libbu++-9e8a4944e50fab432012878c66e1bdac20649f76.zip | |
The Stream Filter archetecture is finished, it's actually much cooler than I
had anticipated, and much cleaner. I'll have to add some documentation to it,
because it's not really obvious how any of it fits together from the outset,
although I have to say that the bzip2 test program is the easiest general bzip2
compression program I've ever made...it just goes :)
Decompression in Bu::BZip2 isn't finished yet, but that's ok, it's coming soon.
Diffstat (limited to 'src/bzip2.h')
| -rw-r--r-- | src/bzip2.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/bzip2.h b/src/bzip2.h new file mode 100644 index 0000000..056f336 --- /dev/null +++ b/src/bzip2.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #ifndef B_ZIP2_H | ||
| 2 | #define B_ZIP2_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | #include <bzlib.h> | ||
| 6 | |||
| 7 | #include "bu/filter.h" | ||
| 8 | |||
| 9 | namespace Bu | ||
| 10 | { | ||
| 11 | /** | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | class BZip2 : public Bu::Filter | ||
| 15 | { | ||
| 16 | public: | ||
| 17 | BZip2( Bu::Stream &rNext, int nCompression=9 ); | ||
| 18 | virtual ~BZip2(); | ||
| 19 | |||
| 20 | virtual void start(); | ||
| 21 | virtual void stop(); | ||
| 22 | virtual size_t read( void *pBuf, size_t nBytes ); | ||
| 23 | virtual size_t write( const void *pBuf, size_t nBytes ); | ||
| 24 | |||
| 25 | private: | ||
| 26 | void bzError( int code ); | ||
| 27 | bz_stream bzState; | ||
| 28 | bool bReading; | ||
| 29 | int nCompression; | ||
| 30 | char *pBuf; | ||
| 31 | uint32_t nBufSize; | ||
| 32 | }; | ||
| 33 | } | ||
| 34 | |||
| 35 | #endif | ||
