generic.h

来自「几种常用的压缩算法 本程序包含以下功能: 1、 Arithmetic cod」· C头文件 代码 · 共 46 行

H
46
字号
#ifndef __GENERIC_H#define __GENERIC_H#ifdef WIN32#include <conio.h>#else#include <unistd.h>#endiftemplate <class T>class TGeneric : public T{private:	int count;public:	TGeneric()	: T()	{		count = 0;	}	virtual ~TGeneric()	{	}	virtual void OnStep()	{		const int divs = 0x200;		char c, *steps = "/-\\|";		c = steps[(count++%(4*divs))/divs];		if (!(count%divs))		{			printf("%c\tStep\t%d\r", c, count);#ifdef WIN32			if (kbhit() && (getch() == 27))			{				printf("\nProcess stopped by user...              \n");				exit(1);			}#else			usleep(1);#endif		}	}};#endif

⌨️ 快捷键说明

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