Files
Upsilon/poincare/src/subtraction.cpp
Romain Goyet dfdaa54928 Poincare: Clean the Expression::Type
Change-Id: I3809a8b1b040314466554866555fb634c35156a5
2016-03-24 10:19:04 +01:00

25 lines
626 B
C++

#include <poincare/subtraction.h>
#include "layout/horizontal_layout.h"
Subtraction::Subtraction(Expression * first_operand, Expression * second_operand) {
m_left = first_operand;
m_right = second_operand;
}
Subtraction::~Subtraction() {
delete m_left;
delete m_right;
}
float Subtraction::approximate(Context& context) {
return m_left->approximate(context) - m_right->approximate(context);
}
Expression::Type Subtraction::type() {
return Expression::Type::Subtraction;
}
ExpressionLayout * Subtraction::createLayout(ExpressionLayout * parent) {
return new HorizontalLayout(parent, m_left, '-', m_right);
}