refs #354, initial cleanup of cfg entries samples / code before adding new functionality

* fixed styles such as copyright headers
* use text stream instead of qDebug() for output
* int instead of qint
* misc. smaller tweaks
* extended the JSON example (special chars). JSON might be used to "cache" the FSX entries
This commit is contained in:
Klaus Basan
2014-12-05 23:44:16 +01:00
parent e75b1360bb
commit e4bea8ffa8
14 changed files with 206 additions and 111 deletions

View File

@@ -1,7 +1,11 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Copyright (C) 2014
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "blacksim/blacksimfreefunctions.h"
#include "blackmisc/blackmiscfreefunctions.h"
@@ -12,40 +16,49 @@
#include <QCoreApplication>
#include <QTextStream>
#include <QDebug>
#include <QTime>
/*!
* Samples
*/
int main(int argc, char *argv[])
{
Q_UNUSED(argc);
Q_UNUSED(argv);
QTextStream streamIn(stdin);
QTextStream streamOut(stdout);
BlackMisc::registerMetadata();
BlackSim::registerMetadata();
qDebug() << "Run samples:";
qDebug() << "1 .. FS common";
qDebug() << "2 .. FSX";
qDebug() << "3 .. Mappings";
qDebug() << "x .. exit";
streamOut << "Run samples:" << endl;
streamOut << "1 .. FS common" << endl;
streamOut << "2 .. FSX" << endl;
streamOut << "3 .. Mappings" << endl;
streamOut << "x .. exit" << endl;
QString i = streamIn.readLine().toLower().trimmed();
QTime t;
t.start();
if (i.startsWith("1"))
{
BlackSimTest::CSamplesFsCommon::samples();
BlackSimTest::CSamplesFsCommon::samples(streamOut, streamIn);
}
else if (i.startsWith("2"))
{
BlackSimTest::CSamplesFsx::samples();
BlackSimTest::CSamplesFsx::samples(streamOut);
}
else if (i.startsWith("3"))
{
BlackSimTest::CSamplesModelMapping::samples();
BlackSimTest::CSamplesModelMapping::samples(streamOut);
}
else if (i.startsWith("x"))
{
return 0;
}
QCoreApplication a(argc, argv);
return a.exec();
streamOut << "time elapsed: " << t.elapsed() << "ms" << endl;
streamOut << "press key to exit" << endl;
streamIn.readLine();
return 0;
}