aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/scalaroperatornode.h
blob: 14f759b569ff44ab7816f86cc71d82af47a439f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef SCALAROPERATORNODE_H
#define SCALAROPERATORNODE_H

#include <QMap>
#include <QChar>

#include "executionnode.h"
#include "scalarresult.h"

class ScalarOperatorNode : public ExecutionNode
{
public:
    enum ScalarOperator {PLUS,MINUS,DIVIDE,MULTIPLICATION};
    ScalarOperatorNode();
    virtual void run(ExecutionNode*);
    bool setOperatorChar(QChar c);
    void setInternalNode(ExecutionNode* node);

    virtual QString toString()const;
    virtual qint64 getPriority() const;


private:
    qint64 add(qint64,qint64);
    qint64 substract(qint64,qint64);
    qreal divide(qint64,qint64);
    qint64 multiple(qint64,qint64);

private:
    ScalarOperator m_myOperator;
    ExecutionNode* m_internalNode;
    QMap<QChar,ScalarOperator> m_scalarOperationList;
    ScalarResult* m_scalarResult;
};

#endif // SCALAROPERATORNODE_H