comparison Core/Toolbox.cpp @ 2926:0bcf46cea4e4

fix for older versions of boost::regex
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Nov 2018 11:55:16 +0100
parents 0a4428aad512
children 89f2c302fc37
comparison
equal deleted inserted replaced
2925:a80ba85d89e6 2926:0bcf46cea4e4
1571 1571
1572 1572
1573 std::string Toolbox::SubstituteVariables(const std::string& source, 1573 std::string Toolbox::SubstituteVariables(const std::string& source,
1574 const std::map<std::string, std::string>& dictionary) 1574 const std::map<std::string, std::string>& dictionary)
1575 { 1575 {
1576 const boost::regex pattern("\\${([^:]*?)}|" // ${what[1]} 1576 const boost::regex pattern("\\$\\{([^:]*?)\\}|" // ${what[1]}
1577 "\\${([^:]*?):-([^'\"]*?)}|" // ${what[2]:-what[3]} 1577 "\\$\\{([^:]*?):-([^'\"]*?)\\}|" // ${what[2]:-what[3]}
1578 "\\${([^:]*?):-\"([^\"]*?)\"}|" // ${what[4]:-"what[5]"} 1578 "\\$\\{([^:]*?):-\"([^\"]*?)\"\\}|" // ${what[4]:-"what[5]"}
1579 "\\${([^:]*?):-'([^']*?)'}"); // ${what[6]:-'what[7]'} 1579 "\\$\\{([^:]*?):-'([^']*?)'\\}"); // ${what[6]:-'what[7]'}
1580 1580
1581 VariableFormatter formatter(dictionary); 1581 VariableFormatter formatter(dictionary);
1582 1582
1583 return boost::regex_replace(source, pattern, formatter); 1583 return boost::regex_replace(source, pattern, formatter);
1584 } 1584 }