poincare_helpers.h
2.12 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
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef SHARED_POINCARE_HELPERS_H
#define SHARED_POINCARE_HELPERS_H
#include <poincare.h>
namespace Shared {
namespace PoincareHelpers {
inline Poincare::ExpressionLayout * CreateLayout(const Poincare::Expression * e) {
return e->createLayout(Poincare::Preferences::sharedPreferences()->displayMode(), Poincare::Preferences::sharedPreferences()->numberOfSignificantDigits());
}
template <class T>
inline int ConvertFloatToText(T d, char * buffer, int bufferSize, int numberOfSignificantDigits) {
return Poincare::PrintFloat::convertFloatToText(d, buffer, bufferSize, numberOfSignificantDigits, Poincare::Preferences::sharedPreferences()->displayMode());
}
inline int WriteTextInBuffer(const Poincare::Expression * e, char * buffer, int bufferSize, int numberOfSignificantDigits = Poincare::PrintFloat::k_numberOfStoredSignificantDigits) {
return e->writeTextInBuffer(buffer, bufferSize, Poincare::Preferences::sharedPreferences()->displayMode(), numberOfSignificantDigits);
}
template <class T>
inline Poincare::Expression * Approximate(const Poincare::Expression * e, Poincare::Context & context) {
return e->approximate<T>(context, Poincare::Preferences::sharedPreferences()->angleUnit(), Poincare::Preferences::sharedPreferences()->complexFormat());
}
template <class T>
inline T ApproximateToScalar(const Poincare::Expression * e, Poincare::Context & context) {
return e->approximateToScalar<T>(context, Poincare::Preferences::sharedPreferences()->angleUnit());
}
template <class T>
inline T ApproximateToScalar(const char * text, Poincare::Context & context) {
return Poincare::Expression::approximateToScalar<T>(text, context, Poincare::Preferences::sharedPreferences()->angleUnit());
}
inline Poincare::Expression * ParseAndSimplify(const char * text, Poincare::Context & context) {
return Poincare::Expression::ParseAndSimplify(text, context, Poincare::Preferences::sharedPreferences()->angleUnit());
}
inline void Simplify(Poincare::Expression ** expressionAddress, Poincare::Context & context) {
return Poincare::Expression::Simplify(expressionAddress, context, Poincare::Preferences::sharedPreferences()->angleUnit());
}
}
}
#endif