From b70ebe4331a970cf0e5bce8f1db0a48d4359e8a9 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 6 Mar 2014 00:06:24 +0100 Subject: [PATCH] refs #74 , sample testing reading the FSX aircraft.cfg entries (for mapping) --- samples/blacksim/main.cpp | 19 +++++++++++++ samples/blacksim/sample_blacksim.pro | 22 +++++++++++++++ samples/blacksim/samplesfscommon.cpp | 41 ++++++++++++++++++++++++++++ samples/blacksim/samplesfscommon.h | 24 ++++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 samples/blacksim/main.cpp create mode 100644 samples/blacksim/sample_blacksim.pro create mode 100644 samples/blacksim/samplesfscommon.cpp create mode 100644 samples/blacksim/samplesfscommon.h diff --git a/samples/blacksim/main.cpp b/samples/blacksim/main.cpp new file mode 100644 index 000000000..17c334cdb --- /dev/null +++ b/samples/blacksim/main.cpp @@ -0,0 +1,19 @@ +/* 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/. */ + +#include "blacksim/blacksimfreefunctions.h" +#include "samplesfscommon.h" +#include + +/*! + * Samples + */ +int main(int argc, char *argv[]) +{ + BlackSim::registerMetadata(); + BlackSimTest::CSamplesFsCommon::samples(); + QCoreApplication a(argc, argv); + return a.exec(); +} diff --git a/samples/blacksim/sample_blacksim.pro b/samples/blacksim/sample_blacksim.pro new file mode 100644 index 000000000..a05009aee --- /dev/null +++ b/samples/blacksim/sample_blacksim.pro @@ -0,0 +1,22 @@ +QT += core dbus network + +TARGET = sample_blacksim +TEMPLATE = app + +CONFIG += console c++11 +CONFIG -= app_bundle + +DEPENDPATH += . ../../src/blackmisc ../../src/blacksim +INCLUDEPATH += . ../../src + +LIBS += -L../../lib -lblacksim -lblackmisc + +win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib ../../lib/blacksim.lib +else: PRE_TARGETDEPS += ../../lib/libblackmisc.a ../../lib/libblacksim.a + +DESTDIR = ../../bin + +HEADERS += *.h +SOURCES += *.cpp + +OTHER_FILES += diff --git a/samples/blacksim/samplesfscommon.cpp b/samples/blacksim/samplesfscommon.cpp new file mode 100644 index 000000000..b9e605440 --- /dev/null +++ b/samples/blacksim/samplesfscommon.cpp @@ -0,0 +1,41 @@ +/* Copyright (C) 2013 VATSIM Community / contributors + * 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/. */ + +#include "samplesfscommon.h" +#include "blacksim/fscommon/aircraftcfgentrieslist.h" +#include +#include + +namespace BlackSimTest +{ + + /* + * Samples + */ + int CSamplesFsCommon::samples() + { + QTextStream streamIn(stdin); + QTextStream streamOut(stdout); + QString fsxDir = "P:/FlightSimulatorX (MSI)/SimObjects"; + streamOut << "Enter FSX directory:" << endl; + streamOut << fsxDir << '\r'; + streamOut.flush(); + QString input = streamIn.readLine(); + if (!input.isEmpty()) fsxDir = input; + + BlackSim::FsCommon::CAircraftCfgEntriesList entriesList(fsxDir); + if (entriesList.existsDir()) + { + streamOut << "reading " << entriesList.getRootDirectory() << endl; + entriesList.read(); + streamOut << "read entries: " << entriesList.size() << endl; + // streamOut << entriesList << endl; + } + + streamOut << "-----------------------------------------------" << endl; + return 0; + } + +} // namespace diff --git a/samples/blacksim/samplesfscommon.h b/samples/blacksim/samplesfscommon.h new file mode 100644 index 000000000..1b6163e84 --- /dev/null +++ b/samples/blacksim/samplesfscommon.h @@ -0,0 +1,24 @@ +/* Copyright (C) 2013 VATSIM Community / contributors + * 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/. */ + +#ifndef BLACKSIMTEST_SAMPLESFSCOMMON_H +#define BLACKSIMTEST_SAMPLESFSCOMMON_H + +namespace BlackSimTest +{ + /*! + * \brief Samples for FsCommon classes + */ + class CSamplesFsCommon + { + public: + /*! + * \brief Run the samples + */ + static int samples(); + }; +} // namespace + +#endif