diff options
Diffstat (limited to 'src/stable/lzma.h')
| -rw-r--r-- | src/stable/lzma.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/stable/lzma.h b/src/stable/lzma.h new file mode 100644 index 0000000..090da8d --- /dev/null +++ b/src/stable/lzma.h | |||
| @@ -0,0 +1,59 @@ | |||
| 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 | * Provides XZ compression and decompression, both LZMA1 (LzmaAlone) as | ||
| 19 | * well as the newer LZMA2 (xz) format. This uses .xz by default. | ||
| 20 | * | ||
| 21 | *@ingroup Streams | ||
| 22 | *@ingroup Compression | ||
| 23 | */ | ||
| 24 | class Lzma : public Bu::Filter | ||
| 25 | { | ||
| 26 | public: | ||
| 27 | enum Format | ||
| 28 | { | ||
| 29 | Xz = 0x01, | ||
| 30 | LzmaAlone = 0x02, | ||
| 31 | }; | ||
| 32 | |||
| 33 | Lzma( Bu::Stream &rNext, int nCompression=6, Format eFmt=Xz ); | ||
| 34 | virtual ~Lzma(); | ||
| 35 | |||
| 36 | virtual void start(); | ||
| 37 | virtual Bu::size stop(); | ||
| 38 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | ||
| 39 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | ||
| 40 | |||
| 41 | virtual bool isOpen(); | ||
| 42 | virtual bool isEos(); | ||
| 43 | |||
| 44 | Bu::size getCompressedSize(); | ||
| 45 | |||
| 46 | private: | ||
| 47 | void lzmaError( int code ); | ||
| 48 | void *prState; | ||
| 49 | bool bReading; | ||
| 50 | int nCompression; | ||
| 51 | char *pBuf; | ||
| 52 | uint32_t nBufSize; | ||
| 53 | Bu::size sTotalOut; | ||
| 54 | Format eFmt; | ||
| 55 | bool bEos; | ||
| 56 | }; | ||
| 57 | } | ||
| 58 | |||
| 59 | #endif | ||
