mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 03:29:58 +02:00
Change the layout creation.
The father now sets itself as teh father of its children. ExpressionLayout do not know anything about expressions now. Change-Id: I28954c78f3102eec056ebbc3c52ccd862a5ab8fd
This commit is contained in:
@@ -2,7 +2,8 @@ extern "C" {
|
||||
#include <stdlib.h>
|
||||
}
|
||||
#include <poincare/function.h>
|
||||
#include "layout/function_layout.h"
|
||||
#include "layout/horizontal_layout.h"
|
||||
#include "layout/string_layout.h"
|
||||
|
||||
Function::Function(Expression * arg, char* function_name, bool clone_operands) {
|
||||
m_arg = (Expression *)malloc(sizeof(Expression));
|
||||
@@ -18,8 +19,15 @@ Function::~Function() {
|
||||
delete m_arg;
|
||||
}
|
||||
|
||||
ExpressionLayout * Function::createLayout(ExpressionLayout * parent) {
|
||||
return new FunctionLayout(parent, m_function_name, m_arg);
|
||||
ExpressionLayout * Function::createLayout() {
|
||||
ExpressionLayout** children_layouts = (ExpressionLayout **)malloc(4*sizeof(ExpressionLayout *));
|
||||
children_layouts[0] = new StringLayout(m_function_name, strlen(m_function_name));
|
||||
char string[2] = {'-', '\0'};
|
||||
children_layouts[1] = new StringLayout(string, 1);
|
||||
children_layouts[2] = m_arg->createLayout();
|
||||
string[0] = ')';
|
||||
children_layouts[3] = new StringLayout(string, 1);
|
||||
return new HorizontalLayout(children_layouts, 4);
|
||||
}
|
||||
|
||||
Expression * Function::operand(int i) {
|
||||
|
||||
Reference in New Issue
Block a user