9#include <framework/utilities/EnvironmentVariables.h>
10#include <boost/algorithm/string.hpp>
11#include <boost/python/import.hpp>
12#include <boost/python/extract.hpp>
24 char* envValue = std::getenv(name.c_str());
25 return envValue !=
nullptr;
30 char* envValue = std::getenv(name.c_str());
31 if (envValue !=
nullptr) {
32 std::string val(envValue);
40 const std::string& separators)
44 std::string value =
get(name);
45 std::vector<std::string> items;
50 boost::split(items, value, boost::is_any_of(separators));
51 std::for_each(items.begin(), items.end(), [](std::string & s) {boost::algorithm::trim(s);});
52 items.erase(std::remove_if(items.begin(), items.end(), [](
const std::string & s) { return s.empty(); }), items.end());
57 const std::string& separators)
60 std::string value =
get(name, fallback);
61 std::vector<std::string> items;
66 boost::split(items, value, boost::is_any_of(separators));
67 std::for_each(items.begin(), items.end(), [](std::string & s) {boost::algorithm::trim(s);});
68 items.erase(std::remove_if(items.begin(), items.end(), [](
const std::string & s) { return s.empty(); }), items.end());
76 namespace py = boost::python;
77 py::object path = py::import(
"os.path");
78 return py::extract<std::string>(path.attr(
"expandvars")(text));
static std::string get(const std::string &name, const std::string &fallback="")
Get the value of an environment variable or the given fallback value if the variable is not set.
static bool isSet(const std::string &name)
Check if a value is set in the database.
static std::vector< std::string > getList(const std::string &name, const std::vector< std::string > &fallback={}, const std::string &separators=" \t\n\r")
Get a list of values from an environment variable or the given fallback list if the variable is not s...
static std::vector< std::string > getOrCreateList(const std::string &name, const std::string &fallback, const std::string &separators=" \t\n\r")
Get a list of values from an environment variable or the given fallback string if the variable is not...
static std::string expand(const std::string &text)
Modify the given string and replace every occurrence of $NAME or ${NAME} with the value of the enviro...
Abstract base class for different kinds of events.