dictionary.h
来自「自己编写的一个采用LZW压缩算法对文件进行压缩的程序;」· C头文件 代码 · 共 64 行
H
64 行
// 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 + =
减小字号Ctrl + -
显示快捷键?