diff --git a/src/blackmisc/simulation/aircraftmodellist.cpp b/src/blackmisc/simulation/aircraftmodellist.cpp index 74f9331e4..4c6a259ef 100644 --- a/src/blackmisc/simulation/aircraftmodellist.cpp +++ b/src/blackmisc/simulation/aircraftmodellist.cpp @@ -506,8 +506,15 @@ namespace BlackMisc return d; } + int CAircraftModelList::removeModelWithString(const QString &modelString, Qt::CaseSensitivity sensitivity) + { + if (modelString.isEmpty()) { return 0; } + return this->removeIf([&](const CAircraftModel & model) { return model.matchesModelString(modelString, sensitivity); }); + } + int CAircraftModelList::removeModelsWithString(const QStringList &modelStrings, Qt::CaseSensitivity sensitivity) { + if (modelStrings.isEmpty()) { return 0; } const int cs = this->size(); (*this) = (this->findByNotInModelStrings(modelStrings, sensitivity)); const int d = cs - this->size(); diff --git a/src/blackmisc/simulation/aircraftmodellist.h b/src/blackmisc/simulation/aircraftmodellist.h index a484ccf95..84868c38b 100644 --- a/src/blackmisc/simulation/aircraftmodellist.h +++ b/src/blackmisc/simulation/aircraftmodellist.h @@ -227,6 +227,10 @@ namespace BlackMisc //! \return number of elements removed int keepModelsWithString(const QStringList &modelStrings, Qt::CaseSensitivity sensitivity); + //! Remove those models with given model strings + //! \return number of elements removed + int removeModelWithString(const QString &modelString, Qt::CaseSensitivity sensitivity); + //! Remove those models with given model strings //! \return number of elements removed int removeModelsWithString(const QStringList &modelStrings, Qt::CaseSensitivity sensitivity);