summaryrefslogtreecommitdiff
path: root/src/stable/lzma.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
committerMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
commit469bbcf0701e1eb8a6670c23145b0da87357e178 (patch)
treeb5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/stable/lzma.h
parentee1b79396076edc4e30aefb285fada03bb45e80d (diff)
downloadlibbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.gz
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.bz2
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.xz
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.zip
Code is all reorganized. We're about ready to release. I should write up a
little explenation of the arrangement.
Diffstat (limited to 'src/stable/lzma.h')
-rw-r--r--src/stable/lzma.h59
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
15namespace 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