00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __libutilxx__sella__util__Compress_H__
00010 #define __libutilxx__sella__util__Compress_H__
00011
00012 #include "../../common.h"
00013
00014 #include <list>
00015 #include <string>
00016
00017 #define SELLA_UTIL_COMPRESS_LEVEL_DEF 9
00018
00019 namespace sella {
00020 namespace util {
00021 class Compress;
00022 }
00023 }
00024
00025 class sella::util::Compress {
00026 public:
00027 Compress(int level = SELLA_UTIL_COMPRESS_LEVEL_DEF);
00028 Compress(const Compress &other);
00029 virtual ~Compress();
00030 Compress& operator=(const Compress &other) throw ();
00031
00032 void clear(void);
00033
00034 void setLevel(int level = SELLA_UTIL_COMPRESS_LEVEL_DEF);
00035 int getLevel(void) const;
00036
00037 bool deflate(const void *uncompressed, size_t len);
00038 bool inflate(const void *compressed, size_t len);
00039
00040 const void* getCompressed(void) const;
00041 const void* getUncompressed(void) const;
00042
00043 size_t getCompressedLen(void) const;
00044 size_t getUncompressedLen(void) const;
00045
00046 protected:
00047 private:
00048 int level;
00049 void *c;
00050 void *un;
00051
00052 size_t clen;
00053 size_t unlen;
00054 };
00055
00056 #endif
00057
00058
00059
00060