+void ArithmeticEvaluator::setVariablesValue(const QHash<QString,double>& _varValues) {
+ varValues = _varValues;
+ /*
+ QHashIterator<QString,double> iterV(varValues);
+ while (iterV.hasNext()) {
+ iterV.next();
+ cout << "var " << qPrintable(iterV.key()) << " = " << iterV.value() << endl;
+ }
+ */
+}
+
+void ArithmeticEvaluator::setVariableNames(const QString& _expression) {
+ varNames.clear();
+ QRegularExpression re("[$][a-zA-Z0-9_]+");
+ QRegularExpressionMatchIterator matcher = re.globalMatch(_expression);
+ while(matcher.hasNext()) {
+ QRegularExpressionMatch m = matcher.next();
+ QString var = m.captured(0);
+ varNames.append(var);
+ }
+}
+