00001 #ifndef CLASSLIB_BZ_COMPRESSOR_H 00002 # define CLASSLIB_BZ_COMPRESSOR_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/zip/Compressor.h" 00007 # include "classlib/zip/BZConstants.h" 00008 00009 namespace lat { 00010 //<<<<<< PUBLIC DEFINES >>>>>> 00011 //<<<<<< PUBLIC CONSTANTS >>>>>> 00012 //<<<<<< PUBLIC TYPES >>>>>> 00013 //<<<<<< PUBLIC VARIABLES >>>>>> 00014 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00015 //<<<<<< CLASS DECLARATIONS >>>>>> 00016 00038 class BZCompressor : public Compressor, public BZConstants 00039 { 00040 public: 00041 BZCompressor (unsigned level = DEFAULT_COMPRESSION, 00042 unsigned workFactor = DEFAULT_WORK_FACTOR); 00043 ~BZCompressor (void); 00044 00045 // Global compressor state 00046 virtual void level (unsigned level); 00047 virtual unsigned level (void) const; 00048 virtual void workFactor (unsigned value); 00049 virtual unsigned workFactor (void) const; 00050 virtual void reset (void); 00051 virtual void end (void); 00052 00053 // Input management 00054 virtual bool more (void) const; 00055 virtual void input (const void *buffer, IOSize length); 00056 virtual void finish (void); 00057 virtual void flush (void); 00058 00059 // Compression 00060 virtual bool finished (void) const; 00061 virtual bool flushed (void) const; 00062 virtual size_t compress (void *into, IOSize length); 00063 00064 // Statistics 00065 virtual unsigned checksum (void) const; 00066 virtual IOOffset in (void) const; 00067 virtual IOOffset out (void) const; 00068 00069 private: 00070 struct Stream; 00071 Stream *m_stream; //< BZLIB state 00072 unsigned m_level; //< Compression blocking factor 00073 unsigned m_workFactor; //< Compression work factor 00074 unsigned m_checksum; //< CRC-32 checksum of input 00075 int m_action; //< Next BZLIB compression action 00076 int m_state; //< BZLIB state from last compression 00077 00078 // undefined, no semantics 00079 BZCompressor (const BZCompressor &other); 00080 BZCompressor &operator= (const BZCompressor &other); 00081 }; 00082 00083 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00084 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00085 00086 } // namespace lat 00087 #endif // CLASSLIB_BZ_COMPRESSOR_H