From 962e047f5482cf2fab359cb9dd1a03b7f1e7fac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 9 May 2017 16:23:29 +0200 Subject: [PATCH] [poincare] Rule of 5 in Poincare Change-Id: I2980927d19781b969dabd22731680190a59e4334 --- apps/apps_container.cpp | 2 +- apps/graph/cartesian_function.cpp | 2 +- poincare/include/poincare/binary_operation.h | 4 ++ poincare/include/poincare/expression.h | 2 +- poincare/include/poincare/expression_layout.h | 2 +- poincare/include/poincare/function.h | 4 ++ poincare/include/poincare/global_context.h | 4 ++ poincare/include/poincare/integer.h | 5 ++- poincare/include/poincare/list_data.h | 4 ++ poincare/include/poincare/matrix.h | 4 ++ poincare/include/poincare/matrix_data.h | 4 ++ poincare/include/poincare/opposite.h | 4 ++ poincare/include/poincare/parenthesis.h | 4 ++ poincare/include/poincare/store.h | 4 ++ poincare/src/expression.cpp | 3 -- poincare/src/layout/absolute_value_layout.h | 4 ++ .../src/layout/baseline_relative_layout.h | 42 ++++++++++--------- poincare/src/layout/bracket_layout.h | 4 ++ poincare/src/layout/condensed_sum_layout.h | 4 ++ poincare/src/layout/conjugate_layout.h | 4 ++ poincare/src/layout/expression_layout.cpp | 3 -- poincare/src/layout/fraction_layout.h | 32 +++++++------- poincare/src/layout/grid_layout.h | 40 ++++++++++-------- poincare/src/layout/horizontal_layout.h | 26 +++++++----- poincare/src/layout/integral_layout.h | 4 ++ poincare/src/layout/nth_root_layout.h | 4 ++ poincare/src/layout/parenthesis_layout.h | 4 ++ poincare/src/layout/sequence_layout.h | 4 ++ poincare/src/layout/string_layout.h | 34 ++++++++------- 29 files changed, 172 insertions(+), 89 deletions(-) diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index f420b6304..ee890eed1 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -12,7 +12,7 @@ AppsContainer::AppsContainer() : Container(), m_window(AppsWindow()), m_emptyBatteryWindow(EmptyBatteryWindow()), - m_globalContext(Poincare::GlobalContext()), + m_globalContext(), m_variableBoxController(&m_globalContext), m_examPopUpController(ExamPopUpController()), m_ledTimer(LedTimer()), diff --git a/apps/graph/cartesian_function.cpp b/apps/graph/cartesian_function.cpp index 67c686734..6bee1cecd 100644 --- a/apps/graph/cartesian_function.cpp +++ b/apps/graph/cartesian_function.cpp @@ -19,7 +19,7 @@ void CartesianFunction::setDisplayDerivative(bool display) { float CartesianFunction::approximateDerivative(float x, Poincare::Context * context) const { Poincare::Complex abscissa = Poincare::Complex::Float(x); Poincare::Expression * args[2] = {m_expression, &abscissa}; - Poincare::Derivative derivative = Poincare::Derivative(); + Poincare::Derivative derivative; derivative.setArgument(args, 2, true); return derivative.approximate(*context); } diff --git a/poincare/include/poincare/binary_operation.h b/poincare/include/poincare/binary_operation.h index 5e62cdbc1..8d9664fed 100644 --- a/poincare/include/poincare/binary_operation.h +++ b/poincare/include/poincare/binary_operation.h @@ -11,6 +11,10 @@ class BinaryOperation : public Expression { public: BinaryOperation(Expression ** operands, bool cloneOperands = true); ~BinaryOperation(); + BinaryOperation(const BinaryOperation& other) = delete; + BinaryOperation(BinaryOperation&& other) = delete; + BinaryOperation& operator=(const BinaryOperation& other) = delete; + BinaryOperation& operator=(BinaryOperation&& other) = delete; bool hasValidNumberOfArguments() const override; const Expression * operand(int i) const override; int numberOfOperands() const override; diff --git a/poincare/include/poincare/expression.h b/poincare/include/poincare/expression.h index 0d44dbd0f..a078507b4 100644 --- a/poincare/include/poincare/expression.h +++ b/poincare/include/poincare/expression.h @@ -84,7 +84,7 @@ public: Default = 2 }; static Expression * parse(char const * string); - virtual ~Expression(); + virtual ~Expression() = default; virtual bool hasValidNumberOfArguments() const = 0; ExpressionLayout * createLayout(FloatDisplayMode floatDisplayMode = FloatDisplayMode::Default, ComplexFormat complexFormat = ComplexFormat::Default) const; // Returned object must be deleted virtual const Expression * operand(int i) const = 0; diff --git a/poincare/include/poincare/expression_layout.h b/poincare/include/poincare/expression_layout.h index ce941b0fd..3d0e65d37 100644 --- a/poincare/include/poincare/expression_layout.h +++ b/poincare/include/poincare/expression_layout.h @@ -8,7 +8,7 @@ namespace Poincare { class ExpressionLayout { public: ExpressionLayout(); - virtual ~ExpressionLayout(); + virtual ~ExpressionLayout() = default; void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = KDColorBlack, KDColor backgroundColor = KDColorWhite); KDPoint origin(); diff --git a/poincare/include/poincare/function.h b/poincare/include/poincare/function.h index e7287e242..c71baebbd 100644 --- a/poincare/include/poincare/function.h +++ b/poincare/include/poincare/function.h @@ -13,6 +13,10 @@ class Function : public Expression { public: Function(const char * name, int requiredNumberOfArguments = 1); ~Function(); + Function(const Function& other) = delete; + Function(Function&& other) = delete; + Function& operator=(const Function& other) = delete; + Function& operator=(Function&& other) = delete; void setArgument(Expression ** args, int numberOfArguments, bool clone = true); void setArgument(ListData * listData, bool clone = true); bool hasValidNumberOfArguments() const override; diff --git a/poincare/include/poincare/global_context.h b/poincare/include/poincare/global_context.h index 3e102cda2..fd160aed8 100644 --- a/poincare/include/poincare/global_context.h +++ b/poincare/include/poincare/global_context.h @@ -14,6 +14,10 @@ class GlobalContext : public Context { public: GlobalContext(); ~GlobalContext(); + GlobalContext(const GlobalContext& other) = delete; + GlobalContext(GlobalContext&& other) = delete; + GlobalContext& operator=(const GlobalContext& other) = delete; + GlobalContext& operator=(GlobalContext&& other) = delete; /* The expression recorded in global context is already a final expression. * Otherwise, we would need the context and the angle unit to evaluate it */ const Expression * expressionForSymbol(const Symbol * symbol) override; diff --git a/poincare/include/poincare/integer.h b/poincare/include/poincare/integer.h index 0b1e21caa..a381e77b0 100644 --- a/poincare/include/poincare/integer.h +++ b/poincare/include/poincare/integer.h @@ -13,13 +13,14 @@ namespace Poincare { class Integer : public LeafExpression { public: Integer(native_int_t i); - Integer(Integer&& other); // C++11 move constructor Integer(const char * digits, bool negative = false); // Digits are NOT NULL-terminated Type type() const override; ~Integer(); - + Integer(Integer&& other); // C++11 move constructor Integer& operator=(Integer&& other); // C++11 move assignment operator + Integer(const Integer& other) = delete; + Integer& operator=(const Integer& other) = delete; // Arithmetic Integer add(const Integer &other) const; diff --git a/poincare/include/poincare/list_data.h b/poincare/include/poincare/list_data.h index 9b5265ecf..52bdfa44d 100644 --- a/poincare/include/poincare/list_data.h +++ b/poincare/include/poincare/list_data.h @@ -9,6 +9,10 @@ class ListData { public: ListData(Expression * operand); ~ListData(); + ListData(const ListData& other) = delete; + ListData(ListData&& other) = delete; + ListData& operator=(const ListData& other) = delete; + ListData& operator=(ListData&& other) = delete; int numberOfOperands() const; const Expression * operand(int i) const; void pushExpression(Expression * operand); diff --git a/poincare/include/poincare/matrix.h b/poincare/include/poincare/matrix.h index 2fba2d6f8..3bd7d0b68 100644 --- a/poincare/include/poincare/matrix.h +++ b/poincare/include/poincare/matrix.h @@ -12,6 +12,10 @@ public: Matrix(MatrixData * matrixData); Matrix(Expression ** newOperands, int numberOfOperands, int m_numberOfColumns, int m_numberOfRows, bool cloneOperands); ~Matrix(); + Matrix(const Matrix& other) = delete; + Matrix(Matrix&& other) = delete; + Matrix& operator=(const Matrix& other) = delete; + Matrix& operator=(Matrix&& other) = delete; bool hasValidNumberOfArguments() const override; const Expression * operand(int i) const override; int numberOfOperands() const override; diff --git a/poincare/include/poincare/matrix_data.h b/poincare/include/poincare/matrix_data.h index 928ad57af..066501d1f 100644 --- a/poincare/include/poincare/matrix_data.h +++ b/poincare/include/poincare/matrix_data.h @@ -12,6 +12,10 @@ public: MatrixData(ListData * listData, bool clone); MatrixData(Expression ** newOperands, int numberOfOperands, int m_numberOfColumns, int m_numberOfRows, bool cloneOperands); ~MatrixData(); + MatrixData(const MatrixData& other) = delete; + MatrixData(MatrixData&& other) = delete; + MatrixData& operator=(const MatrixData& other) = delete; + MatrixData& operator=(MatrixData&& other) = delete; void pushListData(ListData * listData, bool clone); int numberOfRows(); int numberOfColumns(); diff --git a/poincare/include/poincare/opposite.h b/poincare/include/poincare/opposite.h index a102275e6..da28feb2f 100644 --- a/poincare/include/poincare/opposite.h +++ b/poincare/include/poincare/opposite.h @@ -10,6 +10,10 @@ class Opposite : public Expression { public: Opposite(Expression * operand, bool cloneOperands = true); ~Opposite(); + Opposite(const Opposite& other) = delete; + Opposite(Opposite&& other) = delete; + Opposite& operator=(const Opposite& other) = delete; + Opposite& operator=(Opposite&& other) = delete; bool hasValidNumberOfArguments() const override; const Expression * operand(int i) const override; int numberOfOperands() const override; diff --git a/poincare/include/poincare/parenthesis.h b/poincare/include/poincare/parenthesis.h index d0e0b4aea..036f65e70 100644 --- a/poincare/include/poincare/parenthesis.h +++ b/poincare/include/poincare/parenthesis.h @@ -9,6 +9,10 @@ class Parenthesis : public Expression { public: Parenthesis(Expression * operand, bool cloneOperands = true); ~Parenthesis(); + Parenthesis(const Parenthesis& other) = delete; + Parenthesis(Parenthesis&& other) = delete; + Parenthesis& operator=(const Parenthesis& other) = delete; + Parenthesis& operator=(Parenthesis&& other) = delete; bool hasValidNumberOfArguments() const override; const Expression * operand(int i) const override; int numberOfOperands() const override; diff --git a/poincare/include/poincare/store.h b/poincare/include/poincare/store.h index 824b46527..084b30761 100644 --- a/poincare/include/poincare/store.h +++ b/poincare/include/poincare/store.h @@ -10,6 +10,10 @@ class Store : public Expression { public: Store(Symbol * symbol, Expression * value, bool clone = true); ~Store(); + Store(const Store& other) = delete; + Store(Store&& other) = delete; + Store& operator=(const Store& other) = delete; + Store& operator=(Store&& other) = delete; bool hasValidNumberOfArguments() const override; Type type() const override; const Expression * operand(int i) const override; diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index c4e2acfea..4564f1bc2 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -18,9 +18,6 @@ namespace Poincare { static Expression::CircuitBreaker sCircuitBreaker = nullptr; -Expression::~Expression() { -} - #include Expression * Expression::parse(char const * string) { diff --git a/poincare/src/layout/absolute_value_layout.h b/poincare/src/layout/absolute_value_layout.h index a3d702b5a..ae22afbeb 100644 --- a/poincare/src/layout/absolute_value_layout.h +++ b/poincare/src/layout/absolute_value_layout.h @@ -10,6 +10,10 @@ class AbsoluteValueLayout : public ExpressionLayout { public: AbsoluteValueLayout(ExpressionLayout * operandLayout); ~AbsoluteValueLayout(); + AbsoluteValueLayout(const AbsoluteValueLayout& other) = delete; + AbsoluteValueLayout(AbsoluteValueLayout&& other) = delete; + AbsoluteValueLayout& operator=(const AbsoluteValueLayout& other) = delete; + AbsoluteValueLayout& operator=(AbsoluteValueLayout&& other) = delete; protected: void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; KDSize computeSize() override; diff --git a/poincare/src/layout/baseline_relative_layout.h b/poincare/src/layout/baseline_relative_layout.h index 2382d5c50..f313d9212 100644 --- a/poincare/src/layout/baseline_relative_layout.h +++ b/poincare/src/layout/baseline_relative_layout.h @@ -7,25 +7,29 @@ namespace Poincare { class BaselineRelativeLayout : public ExpressionLayout { - public: - enum class Type { - Subscript, - Superscript - }; - BaselineRelativeLayout(ExpressionLayout * baseLayout, ExpressionLayout * indiceLayout, Type type); - ~BaselineRelativeLayout(); - ExpressionLayout * baseLayout(); - ExpressionLayout * indiceLayout(); - protected: - void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; - KDSize computeSize() override; - ExpressionLayout * child(uint16_t index) override; - KDPoint positionOfChild(ExpressionLayout * child) override; - private: - constexpr static KDCoordinate k_indiceHeight = 5; - ExpressionLayout * m_baseLayout; - ExpressionLayout * m_indiceLayout; - Type m_type; +public: + enum class Type { + Subscript, + Superscript + }; + BaselineRelativeLayout(ExpressionLayout * baseLayout, ExpressionLayout * indiceLayout, Type type); + ~BaselineRelativeLayout(); + BaselineRelativeLayout(const BaselineRelativeLayout& other) = delete; + BaselineRelativeLayout(BaselineRelativeLayout&& other) = delete; + BaselineRelativeLayout& operator=(const BaselineRelativeLayout& other) = delete; + BaselineRelativeLayout& operator=(BaselineRelativeLayout&& other) = delete; + ExpressionLayout * baseLayout(); + ExpressionLayout * indiceLayout(); +protected: + void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; + KDSize computeSize() override; + ExpressionLayout * child(uint16_t index) override; + KDPoint positionOfChild(ExpressionLayout * child) override; +private: + constexpr static KDCoordinate k_indiceHeight = 5; + ExpressionLayout * m_baseLayout; + ExpressionLayout * m_indiceLayout; + Type m_type; }; } diff --git a/poincare/src/layout/bracket_layout.h b/poincare/src/layout/bracket_layout.h index b08ada56d..095ca82d2 100644 --- a/poincare/src/layout/bracket_layout.h +++ b/poincare/src/layout/bracket_layout.h @@ -10,6 +10,10 @@ class BracketLayout : public ExpressionLayout { public: BracketLayout(ExpressionLayout * operandLayout); ~BracketLayout(); + BracketLayout(const BracketLayout& other) = delete; + BracketLayout(BracketLayout&& other) = delete; + BracketLayout& operator=(const BracketLayout& other) = delete; + BracketLayout& operator=(BracketLayout&& other) = delete; protected: void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; KDSize computeSize() override; diff --git a/poincare/src/layout/condensed_sum_layout.h b/poincare/src/layout/condensed_sum_layout.h index 0fcc2f9ba..dc52f4e5f 100644 --- a/poincare/src/layout/condensed_sum_layout.h +++ b/poincare/src/layout/condensed_sum_layout.h @@ -10,6 +10,10 @@ class CondensedSumLayout : public ExpressionLayout { public: CondensedSumLayout(ExpressionLayout * baseLayout, ExpressionLayout * subscriptLayout, ExpressionLayout * superscriptLayout = nullptr); ~CondensedSumLayout(); + CondensedSumLayout(const CondensedSumLayout& other) = delete; + CondensedSumLayout(CondensedSumLayout&& other) = delete; + CondensedSumLayout& operator=(const CondensedSumLayout& other) = delete; + CondensedSumLayout& operator=(CondensedSumLayout&& other) = delete; protected: void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; KDSize computeSize() override; diff --git a/poincare/src/layout/conjugate_layout.h b/poincare/src/layout/conjugate_layout.h index 59ff5bd6f..29ebdfaa3 100644 --- a/poincare/src/layout/conjugate_layout.h +++ b/poincare/src/layout/conjugate_layout.h @@ -10,6 +10,10 @@ class ConjugateLayout : public ExpressionLayout { public: ConjugateLayout(ExpressionLayout * operandLayout); ~ConjugateLayout(); + ConjugateLayout(const ConjugateLayout& other) = delete; + ConjugateLayout(ConjugateLayout&& other) = delete; + ConjugateLayout& operator=(const ConjugateLayout& other) = delete; + ConjugateLayout& operator=(ConjugateLayout&& other) = delete; protected: void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; KDSize computeSize() override; diff --git a/poincare/src/layout/expression_layout.cpp b/poincare/src/layout/expression_layout.cpp index fab051990..560eed6f8 100644 --- a/poincare/src/layout/expression_layout.cpp +++ b/poincare/src/layout/expression_layout.cpp @@ -12,9 +12,6 @@ ExpressionLayout::ExpressionLayout() : m_frame(KDRectZero) { } -ExpressionLayout::~ExpressionLayout() { -} - KDCoordinate ExpressionLayout::baseline() { return m_baseline; } diff --git a/poincare/src/layout/fraction_layout.h b/poincare/src/layout/fraction_layout.h index 3453fdbf1..48ff4d389 100644 --- a/poincare/src/layout/fraction_layout.h +++ b/poincare/src/layout/fraction_layout.h @@ -7,20 +7,24 @@ namespace Poincare { class FractionLayout : public ExpressionLayout { - public: - FractionLayout(ExpressionLayout * numerator, ExpressionLayout * denominator); - ~FractionLayout(); - protected: - void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; - KDSize computeSize() override; - ExpressionLayout * child(uint16_t index) override; - KDPoint positionOfChild(ExpressionLayout * child) override; - private: - constexpr static KDCoordinate k_fractionBorderLength = 2; - constexpr static KDCoordinate k_fractionLineMargin = 2; - constexpr static KDCoordinate k_fractionLineHeight = 2; - ExpressionLayout * m_numerator_layout; - ExpressionLayout * m_denominator_layout; +public: + FractionLayout(ExpressionLayout * numerator, ExpressionLayout * denominator); + ~FractionLayout(); + FractionLayout(const FractionLayout& other) = delete; + FractionLayout(FractionLayout&& other) = delete; + FractionLayout& operator=(const FractionLayout& other) = delete; + FractionLayout& operator=(FractionLayout&& other) = delete; +protected: + void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; + KDSize computeSize() override; + ExpressionLayout * child(uint16_t index) override; + KDPoint positionOfChild(ExpressionLayout * child) override; +private: + constexpr static KDCoordinate k_fractionBorderLength = 2; + constexpr static KDCoordinate k_fractionLineMargin = 2; + constexpr static KDCoordinate k_fractionLineHeight = 2; + ExpressionLayout * m_numerator_layout; + ExpressionLayout * m_denominator_layout; }; } diff --git a/poincare/src/layout/grid_layout.h b/poincare/src/layout/grid_layout.h index 92deb27fb..f252f28df 100644 --- a/poincare/src/layout/grid_layout.h +++ b/poincare/src/layout/grid_layout.h @@ -7,24 +7,28 @@ namespace Poincare { class GridLayout : public ExpressionLayout { - public: - GridLayout(ExpressionLayout ** entryLayouts, int numberOfRows, int numberOfColumns); - ~GridLayout(); - protected: - void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; - KDSize computeSize() override; - ExpressionLayout * child(uint16_t index) override; - KDPoint positionOfChild(ExpressionLayout * child) override; - private: - constexpr static KDCoordinate k_gridEntryMargin = 6; - KDCoordinate rowBaseline(int i); - KDCoordinate rowHeight(int i); - KDCoordinate height(); - KDCoordinate columnWidth(int j); - KDCoordinate width(); - ExpressionLayout ** m_entryLayouts; - int m_numberOfRows; - int m_numberOfColumns; +public: + GridLayout(ExpressionLayout ** entryLayouts, int numberOfRows, int numberOfColumns); + ~GridLayout(); + GridLayout(const GridLayout& other) = delete; + GridLayout(GridLayout&& other) = delete; + GridLayout& operator=(const GridLayout& other) = delete; + GridLayout& operator=(GridLayout&& other) = delete; +protected: + void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; + KDSize computeSize() override; + ExpressionLayout * child(uint16_t index) override; + KDPoint positionOfChild(ExpressionLayout * child) override; +private: + constexpr static KDCoordinate k_gridEntryMargin = 6; + KDCoordinate rowBaseline(int i); + KDCoordinate rowHeight(int i); + KDCoordinate height(); + KDCoordinate columnWidth(int j); + KDCoordinate width(); + ExpressionLayout ** m_entryLayouts; + int m_numberOfRows; + int m_numberOfColumns; }; } diff --git a/poincare/src/layout/horizontal_layout.h b/poincare/src/layout/horizontal_layout.h index d787d89de..1770eee1f 100644 --- a/poincare/src/layout/horizontal_layout.h +++ b/poincare/src/layout/horizontal_layout.h @@ -7,17 +7,21 @@ namespace Poincare { class HorizontalLayout : public ExpressionLayout { - public: - HorizontalLayout(ExpressionLayout ** layouts, int number_of_children); - ~HorizontalLayout(); - protected: - void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; - KDSize computeSize() override; - ExpressionLayout * child(uint16_t index) override; - KDPoint positionOfChild(ExpressionLayout * child) override; - private: - int m_number_of_children; - ExpressionLayout ** m_children_layouts; +public: + HorizontalLayout(ExpressionLayout ** layouts, int number_of_children); + ~HorizontalLayout(); + HorizontalLayout(const HorizontalLayout& other) = delete; + HorizontalLayout(HorizontalLayout&& other) = delete; + HorizontalLayout& operator=(const HorizontalLayout& other) = delete; + HorizontalLayout& operator=(HorizontalLayout&& other) = delete; +protected: + void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; + KDSize computeSize() override; + ExpressionLayout * child(uint16_t index) override; + KDPoint positionOfChild(ExpressionLayout * child) override; +private: + int m_number_of_children; + ExpressionLayout ** m_children_layouts; }; } diff --git a/poincare/src/layout/integral_layout.h b/poincare/src/layout/integral_layout.h index 2f78c09a9..2e7059acd 100644 --- a/poincare/src/layout/integral_layout.h +++ b/poincare/src/layout/integral_layout.h @@ -10,6 +10,10 @@ class IntegralLayout : public ExpressionLayout { public: IntegralLayout(ExpressionLayout * lowerBoundLayout, ExpressionLayout * upperBoundLayout, ExpressionLayout * integrandLayout); ~IntegralLayout(); + IntegralLayout(const IntegralLayout& other) = delete; + IntegralLayout(IntegralLayout&& other) = delete; + IntegralLayout& operator=(const IntegralLayout& other) = delete; + IntegralLayout& operator=(IntegralLayout&& other) = delete; constexpr static KDCoordinate k_symbolHeight = 4; constexpr static KDCoordinate k_symbolWidth = 4; protected: diff --git a/poincare/src/layout/nth_root_layout.h b/poincare/src/layout/nth_root_layout.h index e138df140..b75cebdb0 100644 --- a/poincare/src/layout/nth_root_layout.h +++ b/poincare/src/layout/nth_root_layout.h @@ -10,6 +10,10 @@ class NthRootLayout : public ExpressionLayout { public: NthRootLayout(ExpressionLayout * radicandLayout, ExpressionLayout * indexLayout); ~NthRootLayout(); + NthRootLayout(const NthRootLayout& other) = delete; + NthRootLayout(NthRootLayout&& other) = delete; + NthRootLayout& operator=(const NthRootLayout& other) = delete; + NthRootLayout& operator=(NthRootLayout&& other) = delete; constexpr static KDCoordinate k_leftRadixHeight = 8; constexpr static KDCoordinate k_leftRadixWidth = 5; protected: diff --git a/poincare/src/layout/parenthesis_layout.h b/poincare/src/layout/parenthesis_layout.h index 565123359..5b7d81ccc 100644 --- a/poincare/src/layout/parenthesis_layout.h +++ b/poincare/src/layout/parenthesis_layout.h @@ -10,6 +10,10 @@ class ParenthesisLayout : public ExpressionLayout { public: ParenthesisLayout(ExpressionLayout * operandLayout); ~ParenthesisLayout(); + ParenthesisLayout(const ParenthesisLayout& other) = delete; + ParenthesisLayout(ParenthesisLayout&& other) = delete; + ParenthesisLayout& operator=(const ParenthesisLayout& other) = delete; + ParenthesisLayout& operator=(ParenthesisLayout&& other) = delete; constexpr static KDCoordinate k_parenthesisCurveWidth = 5; constexpr static KDCoordinate k_parenthesisCurveHeight = 6; protected: diff --git a/poincare/src/layout/sequence_layout.h b/poincare/src/layout/sequence_layout.h index 469b91a6a..41f3b17bb 100644 --- a/poincare/src/layout/sequence_layout.h +++ b/poincare/src/layout/sequence_layout.h @@ -10,6 +10,10 @@ class SequenceLayout : public ExpressionLayout { public: SequenceLayout(ExpressionLayout * lowerBoundLayout, ExpressionLayout * upperBoundLayout, ExpressionLayout * argumentLayout); ~SequenceLayout(); + SequenceLayout(const SequenceLayout& other) = delete; + SequenceLayout(SequenceLayout&& other) = delete; + SequenceLayout& operator=(const SequenceLayout& other) = delete; + SequenceLayout& operator=(SequenceLayout&& other) = delete; constexpr static KDCoordinate k_symbolHeight = 15; constexpr static KDCoordinate k_symbolWidth = 9; protected: diff --git a/poincare/src/layout/string_layout.h b/poincare/src/layout/string_layout.h index 3a286ee81..4aa4b584e 100644 --- a/poincare/src/layout/string_layout.h +++ b/poincare/src/layout/string_layout.h @@ -7,21 +7,25 @@ namespace Poincare { class StringLayout : public ExpressionLayout { - public: - // Here the inverse is a uint8_t instead of a bool, because the size of a bool is - // not standardized, thus since we call a foreign C function with this value we want to be - // sure about compatibility. - StringLayout(const char * string, size_t length, KDText::FontSize fontSize = KDText::FontSize::Large); - ~StringLayout(); - char * text(); - protected: - void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; - KDSize computeSize() override; - ExpressionLayout * child(uint16_t index) override; - KDPoint positionOfChild(ExpressionLayout * child) override; - private: - char * m_string; - KDText::FontSize m_fontSize; +public: + // Here the inverse is a uint8_t instead of a bool, because the size of a bool is + // not standardized, thus since we call a foreign C function with this value we want to be + // sure about compatibility. + StringLayout(const char * string, size_t length, KDText::FontSize fontSize = KDText::FontSize::Large); + ~StringLayout(); + StringLayout(const StringLayout& other) = delete; + StringLayout(StringLayout&& other) = delete; + StringLayout& operator=(const StringLayout& other) = delete; + StringLayout& operator=(StringLayout&& other) = delete; + char * text(); +protected: + void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override; + KDSize computeSize() override; + ExpressionLayout * child(uint16_t index) override; + KDPoint positionOfChild(ExpressionLayout * child) override; +private: + char * m_string; + KDText::FontSize m_fontSize; }; }