-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
38 lines (31 loc) · 1.11 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
#include <QCommandLineParser>
#include "PLN.h"
#include "FPL.h"
auto main(int argc, char *argv[]) -> int
{
QCoreApplication const app(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription(u"Test for file importing"_qs);
parser.addHelpOption();
parser.process(app);
if (parser.positionalArguments().isEmpty())
{
qCritical() << "File name required.";
return -1;
}
if (parser.positionalArguments().at(0).endsWith("PLN", Qt::CaseInsensitive))
{
qWarning() << "Reading file as PLN" << parser.positionalArguments().at(0);
FileFormats::PLN const PLN(parser.positionalArguments().at(0));
qWarning() << "Errors while reading:" << PLN.error();
qWarning() << "Warnings while reading:" << PLN.warnings();
}
else
{
qWarning() << "Reading file as FPL" << parser.positionalArguments().at(0);
FileFormats::FPL const FPL(parser.positionalArguments().at(0));
qWarning() << "Errors while reading:" << FPL.error();
qWarning() << "Warnings while reading:" << FPL.warnings();
}
return 0;
}