bz2.h

来自「bzlib,一个性能非常强劲的压缩库」· C头文件 代码 · 共 60 行

H
60
字号
/*
 BZClass
 Copyright (c) 2003 by Gilad Novik (gilad@bmidas.com)

 You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise).
 You are allowed to modify the source code in any way you want.
 You can use this code without mention my name in your product, but it would be nice if you DO mention me.
*/
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BZ2_H__A6324CC8_60AE_4B57_8CA4_9B15B48B9000__INCLUDED_)
#define AFX_BZ2_H__A6324CC8_60AE_4B57_8CA4_9B15B48B9000__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define BZ_NO_STDIO
#include "bzlib.h"

class CBZ2Base
{
protected:
	CBZ2Base(char* pWriteBuffer,unsigned int nWriteBufferSize);
protected:
	bz_stream m_Stream;
	char* m_pWriteBuffer;
	unsigned int m_nWriteBufferSize;
};

class CBZ2Compress : CBZ2Base
{
public:
	CBZ2Compress(char* pWriteBuffer,unsigned int nWriteBufferSize,int nBlockSize=9,int nWorkFactor=30);
	virtual ~CBZ2Compress();

public:
	unsigned int Compress();

protected:
	virtual unsigned int OnCompressRead(char* &pBuffer)=0;
	virtual void OnCompressWrite(const char* pBuffer,unsigned int nLength)=0;
};

class CBZ2Decompress : CBZ2Base
{
public:
	CBZ2Decompress(char* pWriteBuffer,unsigned int nWriteBufferSize,int nSmall=false);
	virtual ~CBZ2Decompress();

public:
	unsigned int Decompress();

protected:
	virtual unsigned int OnDecompressRead(char* &pBuffer)=0;
	virtual void OnDecompressWrite(const char* pBuffer,unsigned int nLength)=0;
};

#endif // !defined(AFX_BZ2_H__A6324CC8_60AE_4B57_8CA4_9B15B48B9000__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?