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

📄 lzw.h

📁 Implementation for Lempel-Ziv code. Encoder and decoder are separated. The input is a file and th
💻 H
字号:
#pragma once

#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

#include <string>
#include <list>
#include <algorithm>
#include <limits.h>

#include <fstream>

#define SYMBOL_TYPE unsigned char
#define SYMBOL_SIZE 1
#define SYMBOL_MAX 255
#define BYTES_LIMIT 2

class LZW
{
public:
	LZW(void);
public:
	~LZW(void);

public:
	void Compress(const std::string& sInput, const std::string& sOutput);
	void Decompress(const std::string& SInput, const std::string& sOutput);
private:
	int Search(const std::list <std::string>& T, const std::string& w);
	bool FindIndex(const std::list <std::string>& T, int i, std::string& w);
	int Write(int fdOut, int x);
	int Write(int fdOut, const std::string& w);

};

⌨️ 快捷键说明

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