Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
Gaudi::Parsers::Utils Namespace Reference

Functions

std::string replaceEnvironments (const std::string &input)
 

Function Documentation

std::string Gaudi::Parsers::Utils::replaceEnvironments ( const std::string input)

Definition at line 26 of file Utils.cpp.

{
std::string result=input;// result
const char* re = "\\$(([A-Za-z0-9_]+)|\\(([A-Za-z0-9_]+)\\))";
boost::regex expression(re);
start = input.begin();
end = input.end();
boost::match_results<std::string::const_iterator> what;
boost::match_flag_type flags = boost::match_default;
while ( boost::regex_search(start, end, what, expression, flags ) )
{
std::string var,env;
std::string matched(what[0].first,what[0].second);
std::string v1(what[2].first,what[2].second);
std::string v2(what[3].first,what[3].second);
if ( v1.length()>0){ var = v1; }
else { var = v2; }
System::getEnv(var, env);
if(var != "UNKNOWN") {
boost::algorithm::replace_first(result,matched, env);
}
start = what[0].second;
// update flags:
flags |= boost::match_prev_avail;
flags |= boost::match_not_bob;
}
return result;
}

Generated at Wed Dec 4 2013 14:33:22 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004