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

📄 htcode.cpp

📁 哈夫曼编码解码演示程序
💻 CPP
字号:
// HTCode.cpp: implementation of the CHTCode class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "huffman.h"
#include "HTCode.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CHTCode::CHTCode()
{
}
CHTCode::~CHTCode()
{
	Clear();
}
void CHTCode::Add(CBits*pBits)
{
	ASSERT(pBits);
	m_pHTCode.Add(pBits);
}
CString CHTCode::GetBits(int index)
{
	ASSERT(index>=0&&index<m_pHTCode.GetSize());
	CBits*p=(CBits*)m_pHTCode.GetAt(index);
	return p->GetBits();
}
void CHTCode::Clear()
{
	for(int i=0;i<m_pHTCode.GetSize();i++)
	{
		CBits*p=(CBits*)m_pHTCode.GetAt(i);
		delete p;
	}
	m_pHTCode.RemoveAll();
}
CString CBits::GetBits()
{
	CString str;
	for(int i=MAX_BIT-m_Length;i<MAX_BIT;i++)
	{
		str+=m_Bits[i];
	}
	return str;
}

⌨️ 快捷键说明

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