8#include <framework/utilities/EnvironmentVariables.h>
9#include <boost/algorithm/string.hpp>
10#include <boost/python/import.hpp>
11#include <boost/python/extract.hpp>
21 char* envValue = std::getenv(name.c_str());
22 return envValue !=
nullptr;
27 char* envValue = std::getenv(name.c_str());
28 if (envValue !=
nullptr) {
29 std::string val(envValue);
37 const std::string& separators)
39 if (!
isSet(name))
return fallback;
40 std::string value =
get(name);
41 std::vector<std::string> items;
43 if (value.empty())
return items;
44 boost::split(items, value, boost::is_any_of(separators));
49 const std::string& separators)
52 std::string value =
get(name, fallback);
53 std::vector<std::string> items;
55 if (value.empty())
return items;
56 boost::split(items, value, boost::is_any_of(separators));
64 namespace py = boost::python;
65 py::object path = py::import(
"os.path");
66 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 occurence of $NAME or ${NAME} with the value of the environ...
Abstract base class for different kinds of events.