mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
--------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de> Co-authored-by: ebbit1q <ebbit1q@gmail.com>
28 lines
477 B
C++
28 lines
477 B
C++
#ifndef EXPRESSION_H
|
|
#define EXPRESSION_H
|
|
|
|
#include <QMap>
|
|
#include <QString>
|
|
#include <functional>
|
|
|
|
namespace peg
|
|
{
|
|
template <typename Annotation> struct AstBase;
|
|
struct EmptyType;
|
|
typedef AstBase<EmptyType> Ast;
|
|
} // namespace peg
|
|
|
|
class Expression
|
|
{
|
|
public:
|
|
double value;
|
|
|
|
explicit Expression(double initial = 0);
|
|
double parse(const QString &expr);
|
|
|
|
private:
|
|
double eval(const peg::Ast &ast);
|
|
QMap<QString, std::function<double(double)>> fns;
|
|
};
|
|
|
|
#endif
|