-
Notifications
You must be signed in to change notification settings - Fork 2
/
huff.h
46 lines (40 loc) · 1.31 KB
/
huff.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <string>
#include "list.h"
using namespace std;
class Huff
{
public:
// Constructors.
Huff();
// Methods.
void compress(std::string filename);
void expand(std::string filename);
private:
// Attributes.
List* list;
// Methods.
string buildBytes(string bitflow);
string* buildCode(Node* root);
void buildCode(string* codes, Node* node, string code);
List* buildList(string text);
Node* buildTrie(List* list);
string bytesToBitflow(string bytes);
int find(string text, char charact);
string getFileExtension(string filename, int dotPos);
string getFileWithoutExtension(string filename, int dotPos);
string getOutputFilename(string filename);
void printCode(string* codes);
void printTrie(Node* root);
string read(string filename);
string readFileExtension(string* text);
int readSize(string* text);
Node* readTrie(string* text);
Node* readTrie(string text, int* index);
string translate(string bitflow, int size, Node* root);
string transform(Node* node, string trie);
string transform(Node* node);
string transform(string text, string* table);
void write(string text, string filename);
void write(string fileext, string trie, int size, string bitflow, string filename);
};