📄 encoder.h
字号:
#pragma once
#include "HuffmanTree.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 Encoder
{
public:
// Constructor with parameters
// fileName = the name of the input file
Encoder(LPCWSTR inputFile, LPCWSTR outputFile);
// Destructor
~Encoder(void);
public:
// Encode the input file
void Encode();
private:
// Write the codification of the leaf in buffer
// When buffer become full it's written to file
void WriteToBuffer(unsigned int leafNumber);
// Write the codification of the sumbol in buffer
// When buffer become full it's written to file
void WriteToBuffer(SYMBOL_TYPE symbol);
// Write the buffer to file
void WriteBufferToFile();
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_SIZE];
// the buffer's contor
unsigned int m_contorBuffer;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -