refs #409 Rename ISimulatorModelMappings to IModelMappingsProvider

The reason is that the previous name sounded more like a value
object. But instead it does read the mappings from somwhere.
This commit is contained in:
Roland Winklmeier
2015-05-02 00:40:10 +02:00
parent 6275e06b4f
commit 9e274badf1
7 changed files with 31 additions and 31 deletions

View File

@@ -0,0 +1,54 @@
/* Copyright (C) 2013
* 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 "modelmappingsprovider.h"
using namespace BlackMisc;
using namespace BlackMisc::Network;
namespace BlackMisc
{
namespace Simulation
{
IModelMappingsProvider::IModelMappingsProvider(QObject *parent) : QObject(parent) {}
int IModelMappingsProvider::size() const
{
return this->m_mappings.size();
}
bool IModelMappingsProvider::isEmpty() const
{
return this->m_mappings.isEmpty();
}
const CAircraftMappingList &IModelMappingsProvider::getMappingList() const
{
return this->m_mappings;
}
int IModelMappingsProvider::synchronizeWithExistingModels(const QStringList &modelNames, Qt::CaseSensitivity cs)
{
if (modelNames.isEmpty() || this->m_mappings.isEmpty()) { return this->m_mappings.size(); }
CAircraftMappingList newList;
for (const CAircraftMapping &mapping : this->m_mappings)
{
QString modelString = mapping.getModel().getModelString();
if (modelString.isEmpty()) { continue; }
if (modelNames.contains(modelString, cs))
{
newList.push_back(mapping);
}
}
this->m_mappings = newList;
return this->m_mappings.size();
}
} // namespace
} // namespace