21
21
22
22
#define TRUE 1
23
23
24
- using namespace std ;
25
-
26
- void getAreas (vector<string> *locations);
24
+ void getAreas (std::vector<std::string> *locations);
27
25
int getDate ();
28
26
int getStartHour ();
29
27
int getStartMinute ();
30
28
std::string getParticipant ();
31
29
Alert::WATs getWat ();
32
- string getOrigin ();
33
- string getEvent ();
34
- string getLength ();
30
+ std:: string getOrigin ();
31
+ std:: string getEvent ();
32
+ std:: string getLength ();
35
33
36
34
int main () {
37
35
auto *a = new Alert ();
@@ -55,43 +53,48 @@ int main() {
55
53
a->participant = getParticipant ();
56
54
a->wat = getWat ();
57
55
58
- a->create_alert (" eas_alert_1.wav" );
56
+ std::cout << " Enter file name, should end with .wav: " ;
57
+ std::string filename;
58
+ std::cin >> filename;
59
+
60
+ a->create_alert (filename);
59
61
delete a;
60
62
exit (EXIT_SUCCESS);
61
63
62
64
}
63
65
64
- string getLength () {
65
- vector<string> lengths = {" 0015" , " 0030" , " 0045" , " 0100" , " 0115" , " 0130" , " 0145" , " 0200" , " 0215" , " 2030" };
66
- string length = UI::getChoice (&lengths);
66
+ std:: string getLength () {
67
+ std:: vector<std:: string> lengths = {" 0015" , " 0030" , " 0045" , " 0100" , " 0115" , " 0130" , " 0145" , " 0200" , " 0215" , " 2030" };
68
+ std:: string length = UI::getChoice (&lengths);
67
69
return length;
68
70
}
69
71
70
- string getEvent () {
71
- vector<string> nationalEvents = {" EAN" , " NIC" , " NPT" , " RMT" , " RWT" };
72
+ std:: string getEvent () {
73
+ std:: vector<std:: string> nationalEvents = {" EAN" , " NIC" , " NPT" , " RMT" , " RWT" };
72
74
73
- vector<string> stateEvents = { " ADR" , " AVW" , " AVA" , " BZW" , " BLU" , " CAE" , " CDW" , " CEM" , " CFW" , " CFA" , " DSW" , " EQW" , " EVI" ,
74
- " EWW" , " FRW" , " FFW" , " FFA" , " FFS" , " FLW" , " FLA" , " FLS" , " HMW" , " HWW" , " HWA" , " HUW" , " HUA" ,
75
- " HLS" , " LEW" , " LAE" , " NMN" , " TOE" , " NUW" , " DMO" , " RHW" , " SVR" , " SVA" , " SVS" , " SPW" , " SMW" ,
76
- " SPS" , " SSA" , " SSW" , " TOR" , " TOA" , " TRW" , " TRA" , " TSW" , " TSA" , " VOW" , " WSW" , " WSA" };
77
- vector<string> events;
75
+ std::vector<std::string> stateEvents = { " ADR" , " AVW" , " AVA" , " BZW" , " BLU" , " CAE" , " CDW" , " CEM" , " CFW" , " CFA" , " DSW" , " EQW" , " EVI" ,
76
+ " EWW" , " FRW" , " FFW" , " FFA" , " FFS" , " FLW" , " FLA" , " FLS" , " HMW" , " HWW" , " HWA" , " HUW" , " HUA" ,
77
+ " HLS" , " LEW" , " LAE" , " NMN" , " TOE" , " NUW" , " DMO" , " RHW" , " SVR" , " SVA" , " SVS" , " SPW" , " SMW" ,
78
+ " SPS" , " SSA" , " SSW" , " TOR" , " TOA" , " TRW" , " TRA" , " TSW" , " TSA" , " VOW" , " WSW" , " WSA"
79
+ };
80
+ std::vector<std::string> events;
78
81
events.insert (events.end (), nationalEvents.begin (), nationalEvents.end ());
79
82
events.insert (events.end (), stateEvents.begin (), stateEvents.end ());
80
- string event = UI::getChoice (&events, 6 );
83
+ std:: string event = UI::getChoice (&events, 6 );
81
84
return event;
82
85
}
83
86
84
- string getOrigin () {
85
- vector<string> originators = {" EAS" , " CIV" , " WXR" , " PEP" };
87
+ std:: string getOrigin () {
88
+ std:: vector<std:: string> originators = {" EAS" , " CIV" , " WXR" , " PEP" };
86
89
87
- string origin = UI::getChoice (&originators);
90
+ std:: string origin = UI::getChoice (&originators);
88
91
return origin;
89
92
}
90
93
91
94
Alert::WATs getWat () {
92
- cout << " Select the Attention Tone" ;
93
- vector<string> wats = { " NRW" , " Normal" };
94
- string choice = UI::getChoice (&wats);
95
+ std:: cout << " Select the Attention Tone" << std::endl ;
96
+ std:: vector<std:: string> wats = { " NRW" , " Normal" };
97
+ std:: string choice = UI::getChoice (&wats);
95
98
if (choice == wats[0 ]) {
96
99
return Alert::NRW_WAT;
97
100
} else {
@@ -101,40 +104,41 @@ Alert::WATs getWat() {
101
104
}
102
105
103
106
std::string getParticipant () {
104
- cout << " Participant: " ;
107
+ std:: cout << " Participant: " ;
105
108
std::string part;
106
109
while (TRUE ) {
107
- cin >> part;
110
+ std:: cin >> part;
108
111
if (part.length () != 8 ) {
109
- cout << " Participant must 8 characters long" ;
112
+ std:: cout << " Participant must 8 characters long" ;
110
113
}
111
114
return part;
112
115
}
113
116
}
114
117
115
118
int getDate () {
116
- cout << " Enter Start Date: " ;
117
- return UI::getIntFromUser (0 , 366 );
119
+ std:: cout << " Enter Start Date: " ;
120
+ return UI::getIntFromUser (0 , 366 );
118
121
}
119
122
120
123
int getStartHour () {
121
- cout << " Enter Start Hour: " ;
124
+ std:: cout << " Enter Start Hour: " ;
122
125
return UI::getIntFromUser (0 , 23 );
123
126
}
124
127
125
128
126
129
int getStartMinute () {
127
- cout << " Enter the Start Minute: " ;
130
+ std:: cout << " Enter the Start Minute: " ;
128
131
return UI::getIntFromUser (0 , 59 );
129
132
}
130
133
131
- void getAreas (vector<string> *locations) {
134
+ void getAreas (std::vector<std::string> *locations) {
135
+ std::cout << " Type \" DONE\" when done entering locations" << std::endl;
132
136
for (int i = 0 ; i < 31 ; i++) {
133
- string location;
134
- cout << " Enter location: " ;
135
- cin >> location;
137
+ std:: string location;
138
+ std:: cout << " Enter location: " ;
139
+ std:: cin >> location;
136
140
if (location == " DONE" ) {
137
- cout << " Done Entering locations." << endl;
141
+ std:: cout << " Done Entering locations." << std:: endl;
138
142
break ;
139
143
} else {
140
144
locations->push_back (Utils::zero_pad_int (location, 6 ));
0 commit comments