aboutsummaryrefslogtreecommitdiff
path: root/src/deflate.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-10-27 04:44:46 +0000
committerMike Buland <eichlan@xagasoft.com>2011-10-27 04:44:46 +0000
commit9906ffe3c54875133448134c09ec12a0949d48cd (patch)
tree0542fef3d27e796700b87b44394a3ad31dd5b852 /src/deflate.h
parent411f240da34bab53cd18aa8b7ba09834ede49b1c (diff)
parent029b5d159023f4dad607359dbfaa2479e21fe9e5 (diff)
downloadlibbu++-9906ffe3c54875133448134c09ec12a0949d48cd.tar.gz
libbu++-9906ffe3c54875133448134c09ec12a0949d48cd.tar.bz2
libbu++-9906ffe3c54875133448134c09ec12a0949d48cd.tar.xz
libbu++-9906ffe3c54875133448134c09ec12a0949d48cd.zip
Reorg'd! I merged in the release-fixup branch and fixed all random warnings.
I also cleaned up the build script, the symlink generation is faster and looks nicer, there's one think left to fix there, but it's not too bad.
Diffstat (limited to 'src/deflate.h')
-rw-r--r--src/deflate.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/deflate.h b/src/deflate.h
new file mode 100644
index 0000000..f835cfc
--- /dev/null
+++ b/src/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