swift
Loading...
Searching...
No Matches
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
24using namespace swift::misc;
25using namespace swift::sample;
26using namespace swift::core;
27
29int 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 {
42 qtout << Qt::endl;
43 qtout << "1 .. JSON" << Qt::endl;
44 qtout << "2 .. Change object" << Qt::endl;
45 qtout << "3a .. Containers" << Qt::endl;
46 qtout << "3b .. Callsign QMap vs QHash" << Qt::endl;
47 qtout << "4 .. Metadata" << Qt::endl;
48 qtout << "6a .. Performance create / copy / ..." << Qt::endl;
49 qtout << "6b .. 40/20 Interpolator scenario" << Qt::endl;
50 qtout << "6c .. JSON performance" << Qt::endl;
51 qtout << "6d .. JSON model performance (database vs. own JSON)" << Qt::endl;
52 qtout << "6e .. string utils vs.regex" << Qt::endl;
53 qtout << "6f .. string concatenation (+=, arg, ..)" << Qt::endl;
54 qtout << "6g .. const &QString vs. QStringLiteral" << Qt::endl;
55 qtout << "7 .. Algorithms" << Qt::endl;
56 qtout << "8 .. File/Directory" << Qt::endl;
57 qtout << "-----" << Qt::endl;
58 qtout << "x .. Bye" << Qt::endl;
59 const QString s = qtin.readLine().toLower().trimmed();
60
61 if (s.startsWith("1"))
62 {
64 }
65 else if (s.startsWith("2"))
66 {
68 }
69 else if (s.startsWith("3a"))
70 {
72 }
73 else if (s.startsWith("3b"))
74 {
76 }
77 else if (s.startsWith("4"))
78 {
80 }
81 else if (s.startsWith("6a"))
82 {
84 }
85 else if (s.startsWith("6b"))
86 {
88 }
89 else if (s.startsWith("6c"))
90 {
92 }
93 else if (s.startsWith("6d"))
94 {
96 }
97 else if (s.startsWith("6e"))
98 {
100 }
101 else if (s.startsWith("6f"))
102 {
104 }
105 else if (s.startsWith("6g"))
106 {
108 }
109 else if (s.startsWith("7"))
110 {
112 }
113 else if (s.startsWith("8"))
114 {
116 }
117 else if (s.startsWith("x"))
118 {
119 break;
120 }
121 }
122 while (true);
123 return 0;
124}
static int samples()
Run the samples.
static int samples()
Run the samples.
static int samples()
Run the samples.
static int samples(QTextStream &out)
Run the samples.
static int samples()
Run the samples.
static int samples()
Run the samples.
static int samplesStringUtilsVsRegEx(QTextStream &out)
String manipulation (inserter).
static int samplesStringConcat(QTextStream &out)
String manipulation (concatenation).
static int samplesJsonModelAndLivery(QTextStream &out)
JSON loading (database vs. own format.
static int samplesJson(QTextStream &out)
JSON (de)serialization.
static int samplesMisc(QTextStream &out)
Copy, create, RegEx.
static int sampleQMapVsQHashByCallsign(QTextStream &out)
Callsign based hash/map comparison.
static int samplesStringLiteralVsConstQString(QTextStream &out)
const QString vs. QStringLiteral
static int interpolatorScenario(QTextStream &out, int numberOfCallsigns, int numberOfTimes)
Interpolator scenario.
Backend services of the swift project, like dealing with the network or the simulators.
Definition actionbind.cpp:7
Free functions in swift::misc.
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QString toLower() const const
QString trimmed() const const
QTextStream & endl(QTextStream &stream)
QString readLine(qint64 maxlen)
int main(int argc, char *argv[])
main
Definition main.cpp:29