CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
fireworks::expression Namespace Reference

Functions

long indexFromNewFormatToOldFormat (const std::string &iNewFormat, long iNewFormatIndex, const std::string &iOldFormat)
 
std::string oldToNewFormat (const std::string &iExpression)
 

Function Documentation

long fireworks::expression::indexFromNewFormatToOldFormat ( const std::string &  iNewFormat,
long  iNewFormatIndex,
const std::string &  iOldFormat 
)

Definition at line 35 of file expressionFormatHelpers.cc.

Referenced by FWModelExpressionSelector::select(), FWModelFilter::setExpression(), and FWExpressionEvaluator::setExpression().

38  {
39  if(iNewFormat.substr(0,iNewFormatIndex) ==
40  iOldFormat.substr(0,iNewFormatIndex)) {
41  return iNewFormatIndex;
42  }
43  assert(iNewFormat.size()< iOldFormat.size());
44  std::string::const_iterator itNew = iNewFormat.begin(), itOld = iOldFormat.begin(),
45  itNewEnd = iNewFormat.end();
46  for(;
47  itNew != itNewEnd && itNew-iNewFormat.begin() < iNewFormatIndex;
48  ++itNew, ++itOld) {
49  while(*itNew != *itOld) {
50  assert(itOld != iOldFormat.end());
51  ++itOld;
52  }
53  }
54  return itOld - iOldFormat.begin();
55  }
std::string fireworks::expression::oldToNewFormat ( const std::string &  iExpression)

Definition at line 27 of file expressionFormatHelpers.cc.

Referenced by FWItemValueGetter::addEntry(), FWModelExpressionSelector::select(), FWModelFilter::setExpression(), and FWExpressionEvaluator::setExpression().

27  {
28  //Backwards compatibility with old format: If find a $. or a () just remove them
29  const std::string variable;
30  static boost::regex const reVarName("(\\$\\.)|(\\(\\))");
31 
32  return boost::regex_replace(iExpression,reVarName,variable);
33  }