12 #include <boost/tokenizer.hpp>
13 #include <boost/regex.hpp>
14 #include <boost/algorithm/string.hpp>
24 namespace gpu=Gaudi::Parsers::Utils;
27 std::string result=input;
29 const char* re =
"\\$(([A-Za-z0-9_]+)|\\(([A-Za-z0-9_]+)\\))";
30 std::string::const_iterator
start,
end;
31 boost::regex expression(re);
32 start = input.begin();
34 boost::match_results<std::string::const_iterator> what;
35 boost::match_flag_type flags = boost::match_default;
36 while ( boost::regex_search(start, end, what, expression, flags ) )
39 std::string matched(what[0].first,what[0].second);
40 std::string v1(what[2].first,what[2].second);
41 std::string v2(what[3].first,what[3].second);
43 if ( v1.length()>0){ var = v1; }
47 if(var !=
"UNKNOWN") {
48 boost::algorithm::replace_first(result,matched, env);
50 start = what[0].second;
52 flags |= boost::match_prev_avail;
53 flags |= boost::match_not_bob;
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
std::string replaceEnvironments(const std::string &input)