FeatureSet: Add some helper methods

I used to reimplement these a couple of times already.

Change-Id: I265cf50bf976638b4ac5406ae4010cf33c20354c
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Tobias Hunger
2014-07-30 16:37:41 +02:00
parent 6a52868cdd
commit f130c3c7e5

View File

@@ -77,6 +77,11 @@ public:
return *this;
}
bool isEmpty() const
{
return QSet<Feature>::isEmpty();
}
bool contains(const Feature &feature) const
{
return QSet<Feature>::contains(feature);
@@ -92,6 +97,11 @@ public:
QSet<Feature>::remove(feature);
}
void remove(const FeatureSet &features)
{
QSet<Feature>::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