-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecordApp.hpp
110 lines (92 loc) · 2.34 KB
/
RecordApp.hpp
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#pragma once
#include <vector>
#include <map>
#include <memory>
#include "Person.hpp"
class RecordApp{
public:
void startApp();
enum class MenuOption {
add = 1,
search,
exit
};
enum class ChooseMenu {
name = 1,
otherNames,
mail,
tel,
street,
town,
country,
exit
};
enum class StateStatus {
back = 1,
tryInsterAgain,
deleteItem
} stateStatus_;
private:
void printMenu();
void menuAction();
void addPerson();
void searchPerson();
void exitApp();
void addName();
void addOtherNames();
void addEmail();
void addTelephoneNumber();
void addAddress();
void addStreet();
void addTown();
void addCountry();
bool validName();
bool validOtherNames();
bool validEmail();
bool validTelephoneNumber();
bool validStreet();
bool validTown();
bool validCountry();
bool validValueToFind();
bool ifStringIsAlphabetChar(std::string);
bool maxLengthCheck(int, std::string);
void saveToFile(int);
void resaveToFile();
void loadFromFile();
int countRecord();
void deleteRecord();
void printSearchMenu();
void menuActionSearch();
void insertValueToSearch();
void searchByName(std::string);
void searchByOtherNames(std::string);
void searchByEmail(std::string);
void searchByTel(std::string);
void searchByStreet(std::string);
void searchByTown(std::string);
void searchByCountry(std::string);
void printSearchPersons();
StateStatus actionAfterSearch();
void askIfStopSearch();
std::vector<Person>person_;
//std::vector<Person>searchResult_;
std::map<int, Person>searchResult_;
MenuOption menuOption_ { MenuOption::add };
ChooseMenu menuChooseOption_ { ChooseMenu::name };
int optionMenu_ { 0 };
int optionSearchMenu_ { 0 };
std::string firstName_;
std::string otherNames_;
std::string email_;
std::string tel_;
std::string street_;
std::string town_;
std::string country_;
bool exit_ { false };
bool exitFromSearch_ { false };
std::string whatKindSearch_ { "" };
std::string insertValueToFind_ { "" };
int iterator_ { 0 };
bool ifInsertingStringIsCorrect { true };
int selectPerson_ = { 0 };
};