Files

29 lines
690 B
C++
Raw Permalink Normal View History

2015-12-29 16:09:55 +01:00
#ifndef EXPREVALUATOR_H
#define EXPREVALUATOR_H
#include <QMap>
#include <QString>
#include <QVariant>
#include <functional>
2016-01-18 09:17:42 +01:00
#include "core_global.h"
class CORESHARED_EXPORT ExprEvaluator
2015-12-29 16:09:55 +01:00
{
public:
2023-05-29 16:27:10 +02:00
ExprEvaluator() = default;
2015-12-29 16:09:55 +01:00
2016-01-17 21:09:28 +01:00
bool evaluate(QObject *object, const QString &exp);
void setCaseSensitive(bool caseSensitive);
2015-12-29 16:09:55 +01:00
private:
static const QMap<QString, std::function<bool(QVariant, QVariant)> > m_operations;
2023-05-29 16:27:10 +02:00
bool m_caseSensitive{false};
2016-01-17 21:09:28 +01:00
bool subEval(const QString &oper, const QString &expresion, QObject *object);
void parseExpr(const QString &exp, QVariant &value, QString &oper, QVariant &condition, QObject *object);
2015-12-29 16:09:55 +01:00
};
#endif // EXPREVALUATOR_H