diff options
Diffstat (limited to 'src/LV2Features.cpp')
-rw-r--r-- | src/LV2Features.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp index 65fe6f6b..73cc9382 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard <http://drobilla.net/> + Copyright 2007-2024 David Robillard <http://drobilla.net/> Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -14,10 +14,11 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include "ingen/LV2Features.hpp" +#include <ingen/LV2Features.hpp> -#include "lv2/core/lv2.h" +#include <lv2/core/lv2.h> +#include <algorithm> #include <cstdlib> #include <memory> @@ -30,6 +31,12 @@ LV2Features::Feature::free_feature(LV2_Feature* feature) free(feature); } +std::shared_ptr<LV2_Feature> +LV2Features::EmptyFeature::feature(World& world, Node* block) +{ + return std::make_shared<LV2_Feature>(LV2_Feature{_uri, nullptr}); +} + void LV2Features::add_feature(const std::shared_ptr<Feature>& feature) { @@ -58,12 +65,9 @@ LV2Features::is_supported(const std::string& uri) const return true; } - for (const auto& f : _features) { - if (f->uri() == uri) { - return true; - } - } - return false; + return std::any_of(_features.begin(), + _features.end(), + [&uri](const auto& f) { return f->uri() == uri; }); } std::shared_ptr<LV2Features::FeatureArray> @@ -71,7 +75,7 @@ LV2Features::lv2_features(World& world, Node* node) const { FeatureArray::FeatureVector vec; for (const auto& f : _features) { - std::shared_ptr<LV2_Feature> fptr = f->feature(world, node); + const std::shared_ptr<LV2_Feature> fptr = f->feature(world, node); if (fptr) { vec.push_back(fptr); } |