⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dictionary.h

📁 自己编写的一个采用LZW压缩算法对文件进行压缩的程序;
💻 H
字号:
// Dictionary.h: interface for the CDictionary class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DICTIONARY_H__A8987A3F_0537_433B_9765_DE101A9A94DF__INCLUDED_)
#define AFX_DICTIONARY_H__A8987A3F_0537_433B_9765_DE101A9A94DF__INCLUDED_

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

#define	DICTERR_SUCCESS				0
#define DICTERR_INVALIDPARAM		-1
#define DICTERR_NOTFOUND			-2
#define DICTERR_DICTFULL			-3
#define DICTERR_INITFAIL			-4
#define DICTERR_MEMORY				-5
#define DICTERR_OTHER				-255

class CByteString;

struct DictTree
{	
	int code;	
	unsigned char ch;
	DictTree *sub;
	DictTree *next;
};

struct DictItem
{	
	int code;
	int parent;
	DictTree* tree;
	unsigned char ch;	
};



class CDictionary  
{
public:
	enum{ typeASCII=256 };
public:
	int FindCode(unsigned int code);
	bool GetString(unsigned int code, CByteString& str);
	int AddString(CByteString& byteStr, int parent=-1);
	int FindString(CByteString& byteStr,int parent=-1);
	CDictionary();
	virtual ~CDictionary();

	int Init(unsigned int type=CDictionary::typeASCII);
	void Destroy();

private:
	int m_nRootNum;	
	DictItem* m_pDictItem;
	DictTree* m_pDictTree;
	int m_nCurCode;
	int m_nItemMax;
};

#endif // !defined(AFX_DICTIONARY_H__A8987A3F_0537_433B_9765_DE101A9A94DF__INCLUDED_)

⌨️ 快捷键说明

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