mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
GraphApp: Use a FunctionStore
Change-Id: Ib75947c40167489726fafc493ccb0ebf2862142b
This commit is contained in:
43
apps/graph/function.cpp
Normal file
43
apps/graph/function.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "function.h"
|
||||
|
||||
Graph::Function::Function() :
|
||||
m_text(nullptr),
|
||||
m_expression(nullptr),
|
||||
m_layout(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
Graph::Function::Function(const char * text) :
|
||||
m_text(text), // FIXME: Copy !!
|
||||
m_expression(nullptr),
|
||||
m_layout(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
Graph::Function::~Function() {
|
||||
//FIXME: Free m_text!
|
||||
if (m_layout != nullptr) {
|
||||
delete m_layout;
|
||||
}
|
||||
if (m_expression != nullptr) {
|
||||
delete m_expression;
|
||||
}
|
||||
}
|
||||
|
||||
const char * Graph::Function::text() {
|
||||
return m_text;
|
||||
}
|
||||
|
||||
Expression * Graph::Function::expression() {
|
||||
if (m_expression == nullptr) {
|
||||
m_expression = Expression::parse(m_text);
|
||||
}
|
||||
return m_expression;
|
||||
}
|
||||
|
||||
ExpressionLayout * Graph::Function::layout() {
|
||||
if (m_layout == nullptr) {
|
||||
m_layout = expression()->createLayout();
|
||||
}
|
||||
return m_layout;
|
||||
}
|
||||
Reference in New Issue
Block a user