-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
87 lines (81 loc) · 3.04 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//-----------------------------------------------------------------------
// Project name : Latin assistant
//-----------------------------------------------------------------------
// Source : main.cpp
// Last modified : 01.04.2023
// Version : 10
// Author : Nikita Vakhrushev
//-----------------------------------------------------------------------
#include "latin.h"
using namespace std;
const string USER_OUTPUT_PATH = "UserOutput.txt",
DICTIONARY_LR_PATH = "dictionaryLR.txt",
DICTIONARY_RL_PATH = "dictionaryRL.txt",
LOG_PATH = "log.txt";
WordInfo currentRequest;
Log mainLog(LOG_PATH);
OutputStream mainOutput(USER_OUTPUT_PATH);
int main() {
system("chcp 1251");
bool local_IsActNotepad = false;
if (local_IsActNotepad == true) {
system("taskkill /im notepad.exe");
mainLog.setIsStartNotepadLog(true);
}
mainLog.print("Start: int main()");
currentRequest.setCode(menuCode::DEFAULT);
while (currentRequest.code != menuCode::QUIT) {
system("cls");
if (currentRequest.code == menuCode::DEFAULT) {
currentRequest.clear();
ConsoleOutputBlock startMenuChoice("Нажмите ...", 5,
{ "перевод слова","определение формы слова","редактор сохранённых слов", "Esc - выход из программы" },
{ 1,2,3,-1 });
startMenuChoice.print();
currentRequest.setCode(startMenuChoice.inputChoice());
}
switch (currentRequest.code) {
case menuCode::DICTIONARYSEARCH: {
dictionarySearch(DICTIONARY_LR_PATH, DICTIONARY_RL_PATH);
break;
}
case menuCode::OUT_DICTIONARYSEARCH: {
dictionarySearch(DICTIONARY_LR_PATH, DICTIONARY_RL_PATH);
break;
}
case menuCode::FORMANALYSIS: {
formAnalysis();
break;
}
case menuCode::OUT_FORMANALYSIS: {
formAnalysis();
break;
}
case menuCode::OUTPUTACTION: {
currentRequest.clear();
mainOutput.action();
break;
}
case menuCode::QUIT: {
mainLog.print("= User decided to exit program");
system("cls");
cout << "Сохранить содержание словаря?\n 0 - нет\n Любая другая клавиша - да\n";
char c = _getch();
if (c == '0') {
mainLog.print("= User decided to clear dictionary");
mainOutput.clear();
}
else {
mainLog.print("= User decided to save dictionary");
}
break;
}
default: {
currentRequest.setCode(menuCode::DEFAULT);
break;
}
}
}
mainLog.print("End: int main()");
mainLog.noteExit(100);
}