aboutsummaryrefslogtreecommitdiff
path: root/src/stable/deflate.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/deflate.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/deflate.h')
-rw-r--r--src/stable/deflate.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/stable/deflate.h b/src/stable/deflate.h
new file mode 100644
index 0000000..f835cfc
--- /dev/null
+++ b/src/stable/deflate.h
@@ -0,0 +1,66 @@
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_DEFLATE_H
9#define BU_DEFLATE_H
10
11#include <stdint.h>
12
13#include "bu/filter.h"
14
15namespace Bu
16{
17 /**
18 * Provides Deflate (LZ77) support via zlib. This provides zlib, raw, and
19 * gzip stream types. By default it will autodetect the input type and
20 * encode into a raw deflate stream.
21 *
22 *@ingroup Streams
23 *@ingroup Compression
24 */
25 class Deflate : public Bu::Filter
26 {
27 public:
28 enum Format
29 {
30 Raw = 0x01,
31 Zlib = 0x02,
32 Gzip = 0x03,
33 AutoDetect = 0x04,
34
35 AutoRaw = 0x04|0x01,
36 AutoZlib = 0x04|0x02,
37 AutoGzip = 0x04|0x03
38 };
39
40 Deflate( Bu::Stream &rNext, int nCompression=-1, Format eFmt=AutoZlib );
41 virtual ~Deflate();
42
43 virtual void start();
44 virtual Bu::size stop();
45 virtual Bu::size read( void *pBuf, Bu::size nBytes );
46 virtual Bu::size write( const void *pBuf, Bu::size nBytes );
47
48 virtual bool isOpen();
49 virtual bool isEos();
50
51 Bu::size getCompressedSize();
52
53 private:
54 void zError( int code );
55 void *prState;
56 bool bReading;
57 int nCompression;
58 char *pBuf;
59 uint32_t nBufSize;
60 Bu::size sTotalOut;
61 Format eFmt;
62 bool bEos;
63 };
64}
65
66#endif