swift
main.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
6 
7 #include <stdio.h>
8 #include <stdlib.h>
9 
10 #include <QCoreApplication>
11 #include <QElapsedTimer>
12 #include <QString>
13 #include <QTextStream>
14 #include <QtGlobal>
15 
16 #include "samplesfscommon.h"
17 #include "samplesfsx.h"
18 #include "samplesmodelmapping.h"
19 #include "samplesp3d.h"
20 #include "samplesvpilotrules.h"
21 
22 #include "core/application.h"
23 #include "misc/directoryutils.h"
24 
25 using namespace swift::misc;
26 using namespace swift::sample;
27 
29 int main(int argc, char *argv[])
30 {
31  QCoreApplication qa(argc, argv);
33  Q_UNUSED(a);
34  Q_UNUSED(qa);
35 
36  QTextStream streamIn(stdin);
37  QTextStream streamOut(stdout);
38 
39  bool run = true;
40  QElapsedTimer t;
41  while (run)
42  {
43  streamOut << "Run samples:" << Qt::endl;
44  streamOut << "1 .. FS common / Simulation (with cfg files reading)" << Qt::endl;
45  streamOut << "2 .. FSX" << Qt::endl;
46  streamOut << "3 .. Mappings" << Qt::endl;
47  streamOut << "4 .. vPilot rules" << Qt::endl;
48  streamOut << "5 .. P3D cfg files" << Qt::endl;
49  streamOut << "x .. exit" << Qt::endl;
50  QString i = streamIn.readLine().toLower().trimmed();
51 
52  t.start();
53  if (i.startsWith("1")) { CSamplesFsCommon::samples(streamOut, streamIn); }
54  else if (i.startsWith("2")) { CSamplesFsx::samplesMisc(streamOut); }
55  else if (i.startsWith("3")) { CSamplesModelMapping::samples(streamOut, streamIn); }
56  else if (i.startsWith("4")) { CSamplesVPilotRules::samples(streamOut, streamIn); }
57  else if (i.startsWith("5")) { CSamplesP3D::samplesMisc(streamOut); }
58  else if (i.startsWith("x"))
59  {
60  run = false;
61  streamOut << "terminating" << Qt::endl;
62  }
63 
64  streamOut << Qt::endl;
65  streamOut << Qt::endl;
66  }
67 
68  streamOut << Qt::endl;
69  streamOut << "time elapsed: " << t.elapsed() << "ms" << Qt::endl;
70  streamOut << "press key to exit" << Qt::endl;
71  streamIn.readLine();
72  return EXIT_SUCCESS;
73 }
Free functions in swift::misc.
int main(int argc, char *argv[])
main
Definition: main.cpp:20