Files
Upsilon/poincare/src/parenthesis.cpp
Émilie Feral 6533e115ec [poincare] Parenthesis simplify
Change-Id: I2ebcc1d5148eacb087be407559e5593c6ac6641e
2017-10-05 18:02:38 +02:00

36 lines
940 B
C++

extern "C" {
#include <assert.h>
#include <stdlib.h>
}
#include <poincare/parenthesis.h>
#include "layout/parenthesis_layout.h"
namespace Poincare {
Expression::Type Parenthesis::type() const {
return Type::Parenthesis;
}
Expression * Parenthesis::clone() const {
Parenthesis * o = new Parenthesis(m_operands, true);
return o;
}
ExpressionLayout * Parenthesis::privateCreateLayout(FloatDisplayMode floatDisplayMode, ComplexFormat complexFormat) const {
assert(floatDisplayMode != FloatDisplayMode::Default);
assert(complexFormat != ComplexFormat::Default);
return new ParenthesisLayout(operand(0)->createLayout(floatDisplayMode, complexFormat));
}
void Parenthesis::privateSimplify() {
replaceWith(const_cast<Expression *>(operand(0)), true);
}
template<typename T>
Evaluation<T> * Parenthesis::templatedEvaluate(Context& context, AngleUnit angleUnit) const {
return operand(0)->evaluate<T>(context, angleUnit);
}
}