-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompressor.h
32 lines (27 loc) · 1.02 KB
/
Compressor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef COMPRESSOR_H
#define COMPRESSOR_H
#include <iostream>
#include <fstream>
#include <bitset>
#include <limits>
#include <stack>
#include "HuffmanTree.h"
class Compressor {
public:
Compressor();
~Compressor();
std::string compress(const std::string& filename);
std::string decompress(const std::string& filename);
bool FilesAreIdentical(const std::string& filename1, const std::string& filename2);
private:
static const std::string compressed_file_extension_;
bool FileExists(const std::string& filename);
int GetFileLength(std::ifstream& file);
std::string GetFileBaseName(const std::string& filename);
std::string GetFileExtension(const std::string& filename);
std::string MakeCompressedFileName(const std::string& filename);
std::string MakeUniqueDecompressedFileName(const std::string& basename, const std::string& extension);
void CountByteFrequencies(std::ifstream& ifs, int frequency[256]);
HuffmanTree Unflatten(const std::string& encoding);
};
#endif // COMPRESSOR_H