You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prodejna/core/exprevaluator.h

31 lines
732 B
C++

#ifndef EXPREVALUATOR_H
#define EXPREVALUATOR_H
#include <QMap>
#include <QString>
#include <QVariant>
#include <functional>
class ExprEvaluator
{
public:
ExprEvaluator();
bool evaluate(QObject *object, const QString &exp);
void setCaseSensitive(bool caseSensitive);
private:
#ifdef _MSC_VER
QMap<QString, std::function<bool(QVariant, QVariant)> > m_operations;
#else
static const QMap<QString, std::function<bool(QVariant, QVariant)> > m_operations;
#endif
bool m_caseSensitive;
bool subEval(const QString &oper, const QString &expresion, QObject *object);
void parseExpr(const QString &exp, QVariant &value, QString &oper, QVariant &condition, QObject *object);
};
#endif // EXPREVALUATOR_H