-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (38 loc) · 817 Bytes
/
main.cpp
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
#include <cstring>
#include "lempel_ziv.h"
//#include "lempel_ziv77.h"
#include "lempel_ziv78.h"
#include "lempel_zivW.h"
#define LZ77 0
#define LZ78 1
#define LZW 2
int main(int argc, char* argv[])
{
int encoder_type = LZ78;
LempelZivEncoder *encoder = 0;
if (argc == 3)
{
if (!strcmp(argv[1], "-lz77"))
encoder_type = LZ77;
if (!strcmp(argv[1], "-lz78"))
encoder_type = LZ78;
if (!strcmp(argv[1], "-lzw"))
encoder_type = LZW;
}
switch (encoder_type)
{
/*case LZ77:
encoder = new LempelZiv77Encoder();
break;*/
case LZ78:
encoder = new LempelZiv78Encoder();
break;
case LZW:
encoder = new LempelZivWEncoder();
break;
}
if (argc == 2)
encoder->encode(argv[1]);
else encoder->encode(argv[2]);
return 0;
}