-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (35 loc) · 1.64 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
#include "help_init.h"
int main()
{
qInstallMessageHandler(myMessageOutput);
QTextStream errorStream(stderr);
QFile mapFile(filenames::MAP);
if (!isExistsEndOpen(errorStream, mapFile, QIODevice::ReadOnly)) { return -1; }
QFile dictFile(filenames::DICT);
if (!isExistsEndOpen(errorStream, dictFile, QIODevice::ReadOnly)) { return -1; }
if (!isExists(errorStream, filenames::LUA_MAIN)) { return -1; }
QFile portayalFile(filenames::PORTRAYAL);
if (!isOpen(errorStream,portayalFile, QIODevice::WriteOnly | QIODevice::Text)) { return -1; }
/// -----------------------------------------------------
qInfo("START: Map parsing");
FeatureMapXMLBuilder mapBuilder(&mapFile);
auto mapController = mapBuilder.build(true);
mapFile.close();
qInfo("END: Map parsing");
qInfo("START: Feature Catalog parsing");
FeatureCatalogueXMLBuilder dictBuilder;
auto dictController = dictBuilder.build(&dictFile);
dictFile.close();
qInfo("END: Feature Catalog parsing");
ContexParametrController contextParamCtrl(contextparams::PARAMS);
LuaRuleMashine luaPortoyal(filenames::LUA_MAIN, dictController, mapController, contextParamCtrl);
auto status = luaPortoyal.doPortrayal();
auto msg = std::string(" \n\n--- DO PORTRAYAL STATUS: --- ") + (status ? "true" : "false");
qDebug(msg.c_str());
auto drawInstCtrl = luaPortoyal.drawController();
writeDrawInst(portayalFile, drawInstCtrl, dictController, mapController);
portayalFile.close();
/// -----------------------------------------------------
Profiler::setLogFile(filenames::PROFILE);
Profiler::instance().dumpLog();
}