From e2fbc414b932ae9fd305c8e9fc315a306a876a09 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 24 Oct 2011 16:19:09 +0000 Subject: Lzma filter added. Now we're really getting somewhere. Libbu++ now supports all major, common compression algorithms. --- src/lzma.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/lzma.h (limited to 'src/lzma.h') 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 @@ +/* + * Copyright (C) 2007-2011 Xagasoft, All rights reserved. + * + * This file is part of the libbu++ library and is released under the + * terms of the license contained in the file LICENSE. + */ + +#ifndef BU_LZMA_H +#define BU_LZMA_H + +#include + +#include "bu/filter.h" + +namespace Bu +{ + /** + * + *@ingroup Streams + */ + class Lzma : public Bu::Filter + { + public: + enum Format + { + Xz = 0x01, + LzmaAlone = 0x02, + }; + + Lzma( Bu::Stream &rNext, int nCompression=6, Format eFmt=Xz ); + virtual ~Lzma(); + + virtual void start(); + virtual Bu::size stop(); + virtual Bu::size read( void *pBuf, Bu::size nBytes ); + virtual Bu::size write( const void *pBuf, Bu::size nBytes ); + + virtual bool isOpen(); + virtual bool isEos(); + + Bu::size getCompressedSize(); + + private: + void lzmaError( int code ); + void *prState; + bool bReading; + int nCompression; + char *pBuf; + uint32_t nBufSize; + Bu::size sTotalOut; + Format eFmt; + bool bEos; + }; +} + +#endif -- cgit v1.2.3 From 2f163b90c745491a995dfdbe78464c64a536ec54 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 24 Oct 2011 16:42:22 +0000 Subject: Added some more docs. --- src/bzip2.h | 2 ++ src/deflate.h | 4 ++++ src/doxy/groups.dox | 5 +++++ src/lzma.h | 3 +++ 4 files changed, 14 insertions(+) (limited to 'src/lzma.h') diff --git a/src/bzip2.h b/src/bzip2.h index 0b5140d..9a8d172 100644 --- a/src/bzip2.h +++ b/src/bzip2.h @@ -15,8 +15,10 @@ namespace Bu { /** + * Provides BZip2 type compression and decompression. * *@ingroup Streams + *@ingroup Compression */ class BZip2 : public Bu::Filter { diff --git a/src/deflate.h b/src/deflate.h index 20d609a..34e8657 100644 --- a/src/deflate.h +++ b/src/deflate.h @@ -15,8 +15,12 @@ namespace Bu { /** + * Provides Deflate (LZ77) support via zlib. This provides zlib, raw, and + * gzip stream types. By default it will autodetect the input type and + * encode into a raw deflate stream. * *@ingroup Streams + *@ingroup Compression */ class Deflate : public Bu::Filter { diff --git a/src/doxy/groups.dox b/src/doxy/groups.dox index 479186a..6b7cd57 100644 --- a/src/doxy/groups.dox +++ b/src/doxy/groups.dox @@ -29,3 +29,8 @@ *@defgroup Streams Streams * Streams are for data. */ + +/** + *@defgroup Compression Compression + * Filters that give access to common compression libraries. + */ diff --git a/src/lzma.h b/src/lzma.h index 21da6e8..090da8d 100644 --- a/src/lzma.h +++ b/src/lzma.h @@ -15,8 +15,11 @@ namespace Bu { /** + * Provides XZ compression and decompression, both LZMA1 (LzmaAlone) as + * well as the newer LZMA2 (xz) format. This uses .xz by default. * *@ingroup Streams + *@ingroup Compression */ class Lzma : public Bu::Filter { -- cgit v1.2.3