-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
91 lines (79 loc) · 2.01 KB
/
Copy pathmain.cpp
File metadata and controls
91 lines (79 loc) · 2.01 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
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
#include "inc/helper.h"
#include "inc/IOManager.h"
#include "inc/cjCreator.h"
#include "inc/stringManager.h"
// basic includes
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <algorithm>
#include <chrono>
#include <memory>
// IfcOpenShell includes
#include <ifcparse/IfcFile.h>
#include <ifcparse/IfcHierarchyHelper.h>
#if USE_VLD
#include <vld.h>
#endif
#ifdef _WIN32
#include <windows.h>
void enableVirtualTerminal()
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (hOut == INVALID_HANDLE_VALUE) { return; }
DWORD mode = 0;
if (!GetConsoleMode(hOut, &mode)) { return; }
SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
}
#else
void enableVirtualTerminal() {}
#endif
int main(int argc, char** argv) {
enableVirtualTerminal();
std::cout << " " << std::endl;
auto startTime = std::chrono::high_resolution_clock::now();
std::string issueEncounterString = errorWarningStringEnum::getString(ErrorID::warningIssueencountered);
// outputs errors related to the selected objects
if (false) { Logger::SetOutput(&std::cout, &std::cout); }
IOManager manager;
bool success = false;
if (argc > 1) {
try
{
success = manager.init({ argv[1] });
}
catch (const std::string& exceptionString)
{
std::cout << issueEncounterString << std::endl;
std::cout << exceptionString << std::endl;
success = false;
}
}
else {
try
{
success = manager.init({});
}
catch (const std::string& exceptionString)
{
std::cout << issueEncounterString << std::endl;
std::cout << exceptionString << std::endl;
success = false;
}
}
if (!success)
{
std::cout << errorWarningStringEnum::getString(ErrorID::errorUnableToProcessFile) << std::endl;
manager.write(true);
return 1;
}
if (!manager.run())
{
std::cout << errorWarningStringEnum::getString(ErrorID::errorUnableToProcessFile) << std::endl;
manager.write(true);
return 1;
}
manager.write();
return 0;
}