parenthesis.cpp
1.05 KB
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
38
39
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));
}
Expression * Parenthesis::shallowReduce(Context& context, AngleUnit angleUnit) {
Expression * e = Expression::shallowReduce(context, angleUnit);
if (e != this) {
return e;
}
return replaceWith(editableOperand(0), true);
}
template<typename T>
Expression * Parenthesis::templatedApproximate(Context& context, AngleUnit angleUnit) const {
return operand(0)->approximate<T>(context, angleUnit);
}
}