Numworks Epsilon  1.4.1
Graphing Calculator Operating System
calculation.h
Go to the documentation of this file.
1 #ifndef CALCULATION_CALCULATION_H
2 #define CALCULATION_CALCULATION_H
3 
4 #include <escher.h>
5 #include <poincare.h>
6 
7 namespace Calculation {
8 
9 class CalculationStore;
10 
11 class Calculation {
12 public:
13  Calculation();
14  ~Calculation(); // Delete expression and layout, if needed
15  Calculation& operator=(const Calculation& other);
16  Calculation(const Calculation& other) = delete;
17  Calculation(Calculation&& other) = delete;
18  Calculation& operator=(Calculation&& other) = delete;
19  /* c.reset() is the equivalent of c = Calculation() without copy assingment. */
20  void reset();
21  void setContent(const char * c, Poincare::Context * context, Poincare::Expression * ansExpression);
22  const char * inputText();
23  const char * exactOutputText();
24  const char * approximateOutputText();
25  Poincare::Expression * input();
26  Poincare::ExpressionLayout * inputLayout();
27  Poincare::Expression * approximateOutput(Poincare::Context * context);
28  Poincare::Expression * exactOutput(Poincare::Context * context);
29  Poincare::ExpressionLayout * exactOutputLayout(Poincare::Context * context);
30  Poincare::ExpressionLayout * approximateOutputLayout(Poincare::Context * context);
31  bool isEmpty();
32  void tidy();
33  bool shouldDisplayApproximateOutput(Poincare::Context * context);
34  bool exactAndApproximateDisplayedOutputsAreEqual(Poincare::Context * context);
35  constexpr static int k_printedExpressionSize = 2*::TextField::maxBufferSize();
36 private:
37  /* Buffers holding text expressions have to be longer than the text written
38  * by user (of maximum length TextField::maxBufferSize()) because when we
39  * print an expression we add omitted signs (multiplications, parenthesis...) */
40  char m_inputText[k_printedExpressionSize];
41  char m_exactOutputText[k_printedExpressionSize];
42  char m_approximateOutputText[k_printedExpressionSize];
43  Poincare::Expression * m_input;
44  Poincare::ExpressionLayout * m_inputLayout;
45  Poincare::Expression * m_exactOutput;
46  Poincare::ExpressionLayout * m_exactOutputLayout;
47  Poincare::Expression * m_approximateOutput;
48  Poincare::ExpressionLayout * m_approximateOutputLayout;
49 };
50 
51 }
52 
53 #endif
static constexpr int maxBufferSize()
Definition: text_field.h:23
c(generic_all_nodes)