-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
58 lines (45 loc) · 1.78 KB
/
main.cpp
File metadata and controls
58 lines (45 loc) · 1.78 KB
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
#include <iostream>
#include <chrono>
#include <iomanip>
#include "project_lib/WebsiteSettings.hpp"
#include "project_lib/Website.hpp"
#include "project_lib/TextFileLoader.hpp"
#include "AcceptanceTesting.hpp"
namespace Testing {
const bool TESTING_MODE = false;
void runAll(const WebsiteSettings& settings) {
AcceptanceTesting acceptanceTesting(settings);
acceptanceTesting.readTextFile();
acceptanceTesting.displayAllContacts();
acceptanceTesting.displaySingleRecord();
acceptanceTesting.displayIndexSource();
acceptanceTesting.addElementsToIndex();
acceptanceTesting.displayDetailsSource();
acceptanceTesting.addElementsToDetails();
acceptanceTesting.generateAndSaveWebsite();
}
}
int main() {
auto start = std::chrono::high_resolution_clock::now();
WebsiteSettings settings(
//"/home/user/clionprojects/contacts-explorer/resources/",
//"/var/www/localhost/htdocs/"
R"(C:\Users\James\jcake\contacts-explorer\resources\)",
R"(C:\Users\James\jcake\contacts-explorer\docs\)"
);
Website website(settings);
if (Testing::TESTING_MODE) {
Testing::runAll(settings);
} else {
TextFileLoader textFileLoader{settings.inPath.append("contacts.csv")};
auto records = textFileLoader.getContactRecords();
website.addContactRecords(records);
website.writeToDisk();
}
auto end = std::chrono::high_resolution_clock::now();
float elapsed = std::chrono::duration<float>(end - start).count();
// Display to 3 decimal places (millisecond precision)
std::cout << "Website generated in " << std::fixed << std::setprecision(3)
<< elapsed << " seconds.\n";
return 0; // Hoorah! We made it without a segfault (139)
}