From f130c3c7e5543f8240f16afe17a9a15d94a9c1da Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 30 Jul 2014 16:37:41 +0200 Subject: [PATCH] FeatureSet: Add some helper methods I used to reimplement these a couple of times already. Change-Id: I265cf50bf976638b4ac5406ae4010cf33c20354c Reviewed-by: Tobias Hunger --- src/plugins/coreplugin/featureprovider.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/plugins/coreplugin/featureprovider.h b/src/plugins/coreplugin/featureprovider.h index 9114cb1a45c..27291579b47 100644 --- a/src/plugins/coreplugin/featureprovider.h +++ b/src/plugins/coreplugin/featureprovider.h @@ -77,6 +77,11 @@ public: return *this; } + bool isEmpty() const + { + return QSet::isEmpty(); + } + bool contains(const Feature &feature) const { return QSet::contains(feature); @@ -92,6 +97,11 @@ public: QSet::remove(feature); } + void remove(const FeatureSet &features) + { + QSet::subtract(features); + } + FeatureSet operator|(const Feature &feature) const { FeatureSet copy = *this; @@ -129,6 +139,14 @@ public: stringList.append(feature.toString()); return stringList; } + + static FeatureSet fromStringList(const QStringList &list) + { + FeatureSet features; + foreach (const QString &i, list) + features |= Feature(Id::fromString(i)); + return features; + } }; } // namespace Core