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

29 lines
690 B
C

#ifndef EXPREVALUATOR_H
#define EXPREVALUATOR_H
#include <QMap>
#include <QString>
#include <QVariant>
#include <functional>
9 years ago
#include "core_global.h"
class CORESHARED_EXPORT ExprEvaluator
{
public:
ExprEvaluator() = default;
bool evaluate(QObject *object, const QString &exp);
void setCaseSensitive(bool caseSensitive);
private:
static const QMap<QString, std::function<bool(QVariant, QVariant)> > m_operations;
bool m_caseSensitive{false};
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