#include extern "C" { #include } #include "layout/string_layout.h" namespace Poincare { Expression::Type Undefined::type() const { return Type::Undefined; } Expression * Undefined::clone() const { return new Undefined(); } template Complex * Undefined::templatedApproximate(Context& context, AngleUnit angleUnit) const { return new Complex(Complex::Float(NAN)); } ExpressionLayout * Undefined::privateCreateLayout(FloatDisplayMode floatDisplayMode, ComplexFormat complexFormat) const { char buffer[16]; int numberOfChars = Complex::convertFloatToText(NAN, buffer, 16, 1, floatDisplayMode); return new StringLayout(buffer, numberOfChars); } int Undefined::writeTextInBuffer(char * buffer, int bufferSize, int numberOfSignificantDigits) const { if (bufferSize == 0) { return -1; } return strlcpy(buffer, "undef", bufferSize); } }