diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-10-24 16:19:09 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-10-24 16:19:09 +0000 |
commit | e2fbc414b932ae9fd305c8e9fc315a306a876a09 (patch) | |
tree | 324b2c70cd39b49d1513f64ec7d4b009fda938e9 /src/lzma.h | |
parent | 27c2cbbbc0ed1e1b38274261c33b0427f976f22c (diff) | |
download | libbu++-e2fbc414b932ae9fd305c8e9fc315a306a876a09.tar.gz libbu++-e2fbc414b932ae9fd305c8e9fc315a306a876a09.tar.bz2 libbu++-e2fbc414b932ae9fd305c8e9fc315a306a876a09.tar.xz libbu++-e2fbc414b932ae9fd305c8e9fc315a306a876a09.zip |
Lzma filter added. Now we're really getting somewhere. Libbu++ now supports
all major, common compression algorithms.
Diffstat (limited to '')
-rw-r--r-- | src/lzma.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/lzma.h b/src/lzma.h new file mode 100644 index 0000000..21da6e8 --- /dev/null +++ b/src/lzma.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 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 | |||
8 | #ifndef BU_LZMA_H | ||
9 | #define BU_LZMA_H | ||
10 | |||
11 | #include <stdint.h> | ||
12 | |||
13 | #include "bu/filter.h" | ||
14 | |||
15 | namespace Bu | ||
16 | { | ||
17 | /** | ||
18 | * | ||
19 | *@ingroup Streams | ||
20 | */ | ||
21 | class Lzma : public Bu::Filter | ||
22 | { | ||
23 | public: | ||
24 | enum Format | ||
25 | { | ||
26 | Xz = 0x01, | ||
27 | LzmaAlone = 0x02, | ||
28 | }; | ||
29 | |||
30 | Lzma( Bu::Stream &rNext, int nCompression=6, Format eFmt=Xz ); | ||
31 | virtual ~Lzma(); | ||
32 | |||
33 | virtual void start(); | ||
34 | virtual Bu::size stop(); | ||
35 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | ||
36 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | ||
37 | |||
38 | virtual bool isOpen(); | ||
39 | virtual bool isEos(); | ||
40 | |||
41 | Bu::size getCompressedSize(); | ||
42 | |||
43 | private: | ||
44 | void lzmaError( int code ); | ||
45 | void *prState; | ||
46 | bool bReading; | ||
47 | int nCompression; | ||
48 | char *pBuf; | ||
49 | uint32_t nBufSize; | ||
50 | Bu::size sTotalOut; | ||
51 | Format eFmt; | ||
52 | bool bEos; | ||
53 | }; | ||
54 | } | ||
55 | |||
56 | #endif | ||