mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
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:
54
src/blackmisc/simulation/modelmappingsprovider.cpp
Normal file
54
src/blackmisc/simulation/modelmappingsprovider.cpp
Normal 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
|
||||
Reference in New Issue
Block a user