#include "exprevaluator.h" #ifdef _MSC_VER ExprEvaluator::ExprEvaluator() { m_operations["=="] = [](QVariant left, QVariant right) { return left == right; }; m_operations["!="] = [](QVariant left, QVariant right) { return left != right; }; m_operations["<"] = [](QVariant left, QVariant right) { return left < right; }; m_operations["<="] = [](QVariant left, QVariant right) { return left <= right; }; m_operations[">"] = [](QVariant left, QVariant right) { return left > right; }; m_operations[">="] = [](QVariant left, QVariant right) { return left >= right; }; m_operations["%"] = [](QVariant left, QVariant right) { return left.toString().contains(right.toString()); }; m_operations["||"] = [](QVariant left, QVariant right) { return left.toBool() || right.toBool(); }; m_operations["&&"] = [](QVariant left, QVariant right) { return left.toBool() && right.toBool(); }; } #else const QMap > ExprEvaluator::m_operations = { { "==", [](QVariant left, QVariant right) { return left == right; }}, { "!=", [](QVariant left, QVariant right) { return left != right; }}, { "<", [](QVariant left, QVariant right) { return left < right; }}, { "<=", [](QVariant left, QVariant right) { return left <= right; }}, { ">", [](QVariant left, QVariant right) { return left > right; }}, { ">=", [](QVariant left, QVariant right) { return left >= right; }}, { "%", [](QVariant left, QVariant right) { return left.toString().contains(right.toString()); }}, { "||", [](QVariant left, QVariant right) { return left.toBool() || right.toBool(); }}, { "&&", [](QVariant left, QVariant right) { return left.toBool() && right.toBool(); }} }; ExprEvaluator::ExprEvaluator() { } #endif bool ExprEvaluator::evaluate(const QObject *data, const QString &expression) { return true; }