mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
parent
7b0b04ba8f
commit
6f43162efa
@ -244,6 +244,31 @@ bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disable
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FeatureUtility::CheckFeatureEnabled(const String& feature)
|
||||||
|
{
|
||||||
|
return CheckFeatureInternal(feature, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FeatureUtility::CheckFeatureDisabled(const String& feature)
|
||||||
|
{
|
||||||
|
return CheckFeatureInternal(feature, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FeatureUtility::CheckFeatureInternal(const String& feature, bool check_disabled)
|
||||||
|
{
|
||||||
|
std::vector<String> features;
|
||||||
|
|
||||||
|
if (!FeatureUtility::GetFeatures(features, check_disabled))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
BOOST_FOREACH(const String& check_feature, features) {
|
||||||
|
if (check_feature == feature)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void FeatureUtility::CollectFeatures(const String& feature_file, std::vector<String>& features)
|
void FeatureUtility::CollectFeatures(const String& feature_file, std::vector<String>& features)
|
||||||
{
|
{
|
||||||
String feature = Utility::BaseName(feature_file);
|
String feature = Utility::BaseName(feature_file);
|
||||||
|
@ -45,10 +45,13 @@ public:
|
|||||||
static int ListFeatures(std::ostream& os = std::cout);
|
static int ListFeatures(std::ostream& os = std::cout);
|
||||||
|
|
||||||
static bool GetFeatures(std::vector<String>& features, bool enable);
|
static bool GetFeatures(std::vector<String>& features, bool enable);
|
||||||
|
static bool CheckFeatureEnabled(const String& feature);
|
||||||
|
static bool CheckFeatureDisabled(const String& feature);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FeatureUtility(void);
|
FeatureUtility(void);
|
||||||
static void CollectFeatures(const String& feature_file, std::vector<String>& features);
|
static void CollectFeatures(const String& feature_file, std::vector<String>& features);
|
||||||
|
static bool CheckFeatureInternal(const String& feature, bool check_disabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user