Ref T658, renamed to "MatchingScriptReturnValues" because it is NO object to be used in matching script

This commit is contained in:
Klaus Basan
2019-06-15 00:00:43 +02:00
committed by Mat Sutcliffe
parent 4e24edcb0a
commit 7b6650db32
6 changed files with 19 additions and 19 deletions

View File

@@ -261,7 +261,7 @@ namespace BlackCore
if (useMatchingScript && setup.doRunMsMatchingStageScript())
{
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QStringLiteral("Matching script: Matching stage script used"));
const MSReturnValues rv = CAircraftMatcher::matchingStageScript(remoteAircraft.getModel(), matchedModel, setup, modelSet, log);
const MatchingScriptReturnValues rv = CAircraftMatcher::matchingStageScript(remoteAircraft.getModel(), matchedModel, setup, modelSet, log);
if (rv.runScriptAndModified())
{
matchedModel = rv.model;
@@ -325,28 +325,28 @@ namespace BlackCore
return model;
}
MSReturnValues CAircraftMatcher::reverseLookupScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList *log)
MatchingScriptReturnValues CAircraftMatcher::reverseLookupScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList *log)
{
if (!setup.doRunMsReverseLookupScript()) { return MSReturnValues(inModel); }
if (!setup.doRunMsReverseLookupScript()) { return MatchingScriptReturnValues(inModel); }
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return inModel; }
const QString js = CFileUtils::readFileToString(setup.getMsReverseLookupFile());
static const CAircraftModelList noModelSet;
const MSReturnValues rv = CAircraftMatcher::matchingScript(js, inModel, inModel, setup, noModelSet, ReverseLookup, log);
const MatchingScriptReturnValues rv = CAircraftMatcher::matchingScript(js, inModel, inModel, setup, noModelSet, ReverseLookup, log);
return rv;
}
MSReturnValues CAircraftMatcher::matchingStageScript(const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, CStatusMessageList *log)
MatchingScriptReturnValues CAircraftMatcher::matchingStageScript(const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, CStatusMessageList *log)
{
if (!setup.doRunMsMatchingStageScript()) { return MSReturnValues(inModel); }
if (!setup.doRunMsMatchingStageScript()) { return MatchingScriptReturnValues(inModel); }
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return inModel; }
const QString js = CFileUtils::readFileToString(setup.getMsMatchingStageFile());
const MSReturnValues rv = CAircraftMatcher::matchingScript(js, inModel, matchedModel, setup, modelSet, MatchingStage, log);
const MatchingScriptReturnValues rv = CAircraftMatcher::matchingScript(js, inModel, matchedModel, setup, modelSet, MatchingStage, log);
return rv;
}
MSReturnValues CAircraftMatcher::matchingScript(const QString &js, const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, MatchingScript ms, CStatusMessageList *log)
MatchingScriptReturnValues CAircraftMatcher::matchingScript(const QString &js, const CAircraftModel &inModel, const CAircraftModel &matchedModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, MatchingScript ms, CStatusMessageList *log)
{
MSReturnValues rv(inModel);
MatchingScriptReturnValues rv(inModel);
QString logMessage;
const CCallsign callsign = inModel.getCallsign();
@@ -668,7 +668,7 @@ namespace BlackCore
CAircraftModel reverseModel = reverseLookupModel(modelToLookup, networkLiveryInfo, log);
if (!setup.doRunMsReverseLookupScript()) { return reverseModel; }
const CCallsign cs = modelToLookup.getCallsign();
const MSReturnValues rv = reverseLookupScript(reverseModel, setup, log);
const MatchingScriptReturnValues rv = reverseLookupScript(reverseModel, setup, log);
if (rv.runScriptModifiedAndRerun())
{
CMatchingUtils::addLogDetailsToList(log, cs, QStringLiteral("Matching script: Modified value and requested rerun"));

View File

@@ -92,15 +92,15 @@ namespace BlackCore
//! Run the network reverse lookup script
//! \threadsafe
//! \ingroup reverselookup
static BlackMisc::Simulation::MSReturnValues reverseLookupScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList *log);
static BlackMisc::Simulation::MatchingScriptReturnValues reverseLookupScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList *log);
//! Run the matching stage lookup script
//! \threadsafe
static BlackMisc::Simulation::MSReturnValues matchingStageScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftModel &matchedModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, const BlackMisc::Simulation::CAircraftModelList &modelSet, BlackMisc::CStatusMessageList *log);
static BlackMisc::Simulation::MatchingScriptReturnValues matchingStageScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftModel &matchedModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, const BlackMisc::Simulation::CAircraftModelList &modelSet, BlackMisc::CStatusMessageList *log);
//! Run the matching script
//! \threadsafe
static BlackMisc::Simulation::MSReturnValues matchingScript(const QString &js,
static BlackMisc::Simulation::MatchingScriptReturnValues matchingScript(const QString &js,
const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftModel &matchedModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup,
const BlackMisc::Simulation::CAircraftModelList &modelSet, BlackMisc::Simulation::MatchingScript ms,
BlackMisc::CStatusMessageList *log);

View File

@@ -847,7 +847,7 @@ namespace BlackCore
// Script
if (runMatchinScript && setup.doRunMsReverseLookupScript())
{
const MSReturnValues rv = CAircraftMatcher::reverseLookupScript(lookupModel, setup, log);
const MatchingScriptReturnValues rv = CAircraftMatcher::reverseLookupScript(lookupModel, setup, log);
if (rv.runScriptAndModified())
{
if (rv.runScriptAndRerun())

View File

@@ -272,12 +272,12 @@ namespace BlackGui
return model;
}
MSReturnValues CModelMatcherComponent::matchingScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList &msgs)
MatchingScriptReturnValues CModelMatcherComponent::matchingScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList &msgs)
{
// Script
if (setup.doRunMsReverseLookupScript())
{
const MSReturnValues rv = CAircraftMatcher::reverseLookupScript(inModel, setup, &msgs);
const MatchingScriptReturnValues rv = CAircraftMatcher::reverseLookupScript(inModel, setup, &msgs);
if (rv.runScriptAndModified())
{
return rv;

View File

@@ -94,7 +94,7 @@ namespace BlackGui
BlackMisc::Simulation::CAircraftModel defaultModel() const;
//! Run matching script
static BlackMisc::Simulation::MSReturnValues matchingScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList &msgs);
static BlackMisc::Simulation::MatchingScriptReturnValues matchingScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList &msgs);
QScopedPointer<Ui::CModelMatcherComponent> ui;
QPointer<Views::CAircraftModelView> m_workbenchView; //!< an external workbenc

View File

@@ -29,10 +29,10 @@ namespace BlackMisc
BLACKMISC_EXPORT const QString &msToString(MatchingScript ms);
//! Return values
struct MSReturnValues
struct MatchingScriptReturnValues
{
//! Ctor
MSReturnValues(const BlackMisc::Simulation::CAircraftModel &model) : model(model) {}
MatchingScriptReturnValues(const BlackMisc::Simulation::CAircraftModel &model) : model(model) {}
BlackMisc::Simulation::CAircraftModel model; //!< the model
bool modified = false; //!< modified?