25 #include <boost/spirit/include/qi.hpp> 26 namespace qi = boost::spirit::qi;
33 bool parseLine(std::string
const& line, std::string& pref) {
34 using it = std::string::const_iterator;
37 qi::rule<it, std::string()> nan = -qi::lit(
"1.0#") >> qi::no_case[
"nan"] >> -(
'(' >> *(qi::char_ -
')') >>
')');
38 qi::rule<it, std::string()> inf = qi::no_case[qi::lit(
"inf") >> -qi::lit(
"inity")];
39 qi::rule<it, std::string()> sign = qi::lit(
'+') |
'-';
42 it first = line.begin(), last = line.end();
43 return (qi::phrase_parse(first, last, -sign >> ( inf | nan) ,qi::blank, pref));
49 FlowCoef::FlowCoef(
const string& formula)
51 const char*
f=formula.c_str();
58 }
else coef=strtod(
f,&
tail);
bool parseLine(std::string const &line, std::string &pref)
std::string trimWS(const std::string &s)
std::string str(T x)
utility function to create a string representation of a numeric type