swift
main.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
4 #include <stdio.h>
5 
6 #include <QCoreApplication>
7 #include <QString>
8 #include <QTextStream>
9 
10 #include "samplesalgorithm.h"
11 #include "sampleschangeobject.h"
12 #include "samplescontainer.h"
13 #include "samplesfile.h"
14 #include "samplesjson.h"
15 #include "samplesmetadata.h"
16 #include "samplesperformance.h"
17 
18 #include "core/application.h"
19 #include "misc/directoryutils.h"
20 
23 
24 using namespace swift::misc;
25 using namespace swift::sample;
26 using namespace swift::core;
27 
29 int main(int argc, char *argv[])
30 {
31  // I use CGuiApplication and not core application
32  // otherwise no QPixmap metadata (metadata sample)
33  QCoreApplication qa(argc, argv);
34  CApplication a(CApplicationInfo::Sample);
35  Q_UNUSED(qa);
36  Q_UNUSED(a);
37  QTextStream qtout(stdout);
38  QTextStream qtin(stdin);
39 
40  do {
41  qtout << Qt::endl;
42  qtout << "1 .. JSON" << Qt::endl;
43  qtout << "2 .. Change object" << Qt::endl;
44  qtout << "3a .. Containers" << Qt::endl;
45  qtout << "3b .. Callsign QMap vs QHash" << Qt::endl;
46  qtout << "4 .. Metadata" << Qt::endl;
47  qtout << "6a .. Performance create / copy / ..." << Qt::endl;
48  qtout << "6b .. 40/20 Interpolator scenario" << Qt::endl;
49  qtout << "6c .. JSON performance" << Qt::endl;
50  qtout << "6d .. JSON model performance (database vs. own JSON)" << Qt::endl;
51  qtout << "6e .. string utils vs.regex" << Qt::endl;
52  qtout << "6f .. string concatenation (+=, arg, ..)" << Qt::endl;
53  qtout << "6g .. const &QString vs. QStringLiteral" << Qt::endl;
54  qtout << "7 .. Algorithms" << Qt::endl;
55  qtout << "8 .. File/Directory" << Qt::endl;
56  qtout << "-----" << Qt::endl;
57  qtout << "x .. Bye" << Qt::endl;
58  const QString s = qtin.readLine().toLower().trimmed();
59 
60  if (s.startsWith("1")) { CSamplesJson::samples(); }
61  else if (s.startsWith("2")) { CSamplesChangeObject::samples(); }
62  else if (s.startsWith("3a")) { CSamplesContainer::samples(); }
63  else if (s.startsWith("3b")) { CSamplesPerformance::sampleQMapVsQHashByCallsign(qtout); }
64  else if (s.startsWith("4")) { CSamplesMetadata::samples(); }
65  else if (s.startsWith("6a")) { CSamplesPerformance::samplesMisc(qtout); }
66  else if (s.startsWith("6b")) { CSamplesPerformance::interpolatorScenario(qtout, 40, 20); }
67  else if (s.startsWith("6c")) { CSamplesPerformance::samplesJson(qtout); }
68  else if (s.startsWith("6d")) { CSamplesPerformance::samplesJsonModelAndLivery(qtout); }
69  else if (s.startsWith("6e")) { CSamplesPerformance::samplesStringUtilsVsRegEx(qtout); }
70  else if (s.startsWith("6f")) { CSamplesPerformance::samplesStringConcat(qtout); }
71  else if (s.startsWith("6g")) { CSamplesPerformance::samplesStringLiteralVsConstQString(qtout); }
72  else if (s.startsWith("7")) { CSamplesAlgorithm::samples(); }
73  else if (s.startsWith("8")) { CSamplesFile::samples(qtout); }
74  else if (s.startsWith("x")) { break; }
75  }
76  while (true);
77  return 0;
78 }
Backend services of the swift project, like dealing with the network or the simulators.
Definition: actionbind.cpp:7
Free functions in swift::misc.
int main(int argc, char *argv[])
main
Definition: main.cpp:20