-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.cpp
45 lines (41 loc) · 1.22 KB
/
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 "./gtts.h"
#include <memory>
int main(int argc, char *argv[]) {
typedef std::string string;
switch(argc) {
case 2:
if (string("-h") == argv[1]
|| string("-H") == argv[1]
|| string("--help") == argv[1]) {
gtts::GoogleTTS::help();
}
if (string("-v") == argv[1] || string("--version") == argv[1]) {
gtts::GoogleTTS::version();
}
if (string("-l") == argv[1] || string("--languages") == argv[1]) {
gtts::GoogleTTS::languages();
}
break;
case 3: {
string msg(argv[2]);
string lang(argv[1]);
std::unique_ptr<gtts::GoogleTTS>
tts(new gtts::GoogleTTS(msg, lang));
tts->execute();
}
break;
case 4: {
string msg(argv[2]);
string lang(argv[1]);
string speed(argv[3]);
std::unique_ptr<gtts::GoogleTTS>
tts(new gtts::GoogleTTS(msg, lang, speed));
tts->execute();
}
break;
default:
gtts::GoogleTTS::help();
break;
}
return 0;
}