2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-10-18 19:31:52 +02:00
|
|
|
|
|
|
|
#ifndef FEATUREUTILITY_H
|
|
|
|
#define FEATUREUTILITY_H
|
|
|
|
|
|
|
|
#include "base/i2-base.hpp"
|
2015-02-26 11:04:57 +01:00
|
|
|
#include "cli/i2-cli.hpp"
|
2014-10-19 14:48:19 +02:00
|
|
|
#include "base/string.hpp"
|
2014-10-18 19:31:52 +02:00
|
|
|
#include <vector>
|
2015-02-15 13:09:53 +01:00
|
|
|
#include <iostream>
|
2014-10-18 19:31:52 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup cli
|
|
|
|
*/
|
2017-12-31 07:22:16 +01:00
|
|
|
class FeatureUtility
|
2014-10-18 19:31:52 +02:00
|
|
|
{
|
|
|
|
public:
|
2018-01-04 04:25:35 +01:00
|
|
|
static String GetFeaturesAvailablePath();
|
|
|
|
static String GetFeaturesEnabledPath();
|
2014-10-18 19:31:52 +02:00
|
|
|
|
2014-10-21 18:35:43 +02:00
|
|
|
static std::vector<String> GetFieldCompletionSuggestions(const String& word, bool enable);
|
|
|
|
|
2018-07-26 17:09:06 +02:00
|
|
|
static int EnableFeatures(const std::vector<std::string>& features);
|
|
|
|
static int DisableFeatures(const std::vector<std::string>& features);
|
2015-01-22 12:10:32 +01:00
|
|
|
static int ListFeatures(std::ostream& os = std::cout);
|
2014-10-21 18:35:43 +02:00
|
|
|
|
|
|
|
static bool GetFeatures(std::vector<String>& features, bool enable);
|
2015-06-25 10:14:19 +02:00
|
|
|
static bool CheckFeatureEnabled(const String& feature);
|
|
|
|
static bool CheckFeatureDisabled(const String& feature);
|
2014-10-21 18:35:43 +02:00
|
|
|
|
2014-10-18 19:31:52 +02:00
|
|
|
private:
|
2018-01-04 04:25:35 +01:00
|
|
|
FeatureUtility();
|
2014-10-18 19:31:52 +02:00
|
|
|
static void CollectFeatures(const String& feature_file, std::vector<String>& features);
|
2015-06-25 10:14:19 +02:00
|
|
|
static bool CheckFeatureInternal(const String& feature, bool check_disabled);
|
2014-10-18 19:31:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* FEATUREUTILITY_H */
|