📄 decoder.h
字号:
#pragma once
#include "HuffmanTree.h"
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <assert.h>
class Decoder
{
public:
// Constructor with parameters
// fileName = the name of the input file
Decoder(LPCWSTR inputFile, LPCWSTR outputFile);
// Destructor
~Decoder(void);
public:
// Decode the input file
void Decode();
private:
// Write the buffer to file
// Insert the written symbol in the tree
void WriteToBuffer(SYMBOL_TYPE symbol);
// Write the buffer to file
void WriteBufferToFile();
// Write a symbol to file
void WriteSymbolToFile(SYMBOL_TYPE symbol);
// Tests if the buffer reprezent a symbol
// Return:
// -1 : for "esc" symbol
// -2 : if the buffer contains no codification
// (int) : the symbol corresponding to buffer codification
int TestBuffer();
protected:
// The intput file
//int m_inputFile;
//std::ifstream m_inputFile;
HANDLE m_inputFile;
// The output file
//int m_outputFile;
//std::ofstream m_outputFile;
HANDLE m_outputFile;
private:
// The Huffman tree used for encoding
HuffmanTree m_tree;
// va retine codificarea pana la scriere in fisier
// codificarea va fi inversata, de la frunze la radacina si nu de la radacina la frunze
bool m_buffer[SYMBOL_NUMBER];
// the buffer's contor
unsigned int m_contorBuffer;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -