From 22549d4d507ee50e1cc8f24a22142eb938ac9478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 16 Jul 2020 14:14:21 +0200 Subject: [PATCH] [apps/calculation] CalculationStore: change name CalculationHeight --> HeightComputer --- apps/calculation/calculation_store.cpp | 14 +++++++------- apps/calculation/calculation_store.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/calculation/calculation_store.cpp b/apps/calculation/calculation_store.cpp index 00cef4b06..d39684424 100644 --- a/apps/calculation/calculation_store.cpp +++ b/apps/calculation/calculation_store.cpp @@ -50,7 +50,7 @@ ExpiringPointer CalculationStore::calculationAtIndex(int i) { return calculationAtIndex(i); } -ExpiringPointer CalculationStore::push(const char * text, Context * context, CalculationHeight height) { +ExpiringPointer CalculationStore::push(const char * text, Context * context, HeightComputer heightComputer) { /* Compute ans now, before the buffer is slided and before the calculation * might be deleted */ Expression ans = ansExpression(context); @@ -84,7 +84,7 @@ ExpiringPointer CalculationStore::push(const char * text, Context * /* If the input does not fit in the store (event if the current * calculation is the only calculation), just replace the calculation with * undef. */ - return emptyStoreAndPushUndef(context, height); + return emptyStoreAndPushUndef(context, heightComputer); } nextSerializationLocation += strlen(nextSerializationLocation) + 1; } @@ -115,7 +115,7 @@ ExpiringPointer CalculationStore::push(const char * text, Context * * undef if it fits, else replace the whole calcualtion with undef. */ Expression undef = Undefined::Builder(); if (!pushSerializeExpression(undef, nextSerializationLocation, &newCalculationsLocation)) { - return emptyStoreAndPushUndef(context, height); + return emptyStoreAndPushUndef(context, heightComputer); } } nextSerializationLocation += strlen(nextSerializationLocation) + 1; @@ -138,8 +138,8 @@ ExpiringPointer CalculationStore::push(const char * text, Context * * can't change anymore: the calculation heights are fixed which ensures that * scrolling computation is right. */ calculation->setHeights( - height(calculation.pointer(), false), - height(calculation.pointer(), true)); + heightComputer(calculation.pointer(), false), + heightComputer(calculation.pointer(), true)); return calculation; } @@ -259,12 +259,12 @@ const char * CalculationStore::lastCalculationPosition(const char * calculations return reinterpret_cast(c); } -Shared::ExpiringPointer CalculationStore::emptyStoreAndPushUndef(Context * context, CalculationHeight height) { +Shared::ExpiringPointer CalculationStore::emptyStoreAndPushUndef(Context * context, HeightComputer heightComputer) { /* We end up here as a result of a failed calculation push. The store * attributes are not necessarily clean, so we need to reset them. */ m_slidedBuffer = false; deleteAll(); - return push(Undefined::Name(), context, height); + return push(Undefined::Name(), context, heightComputer); } void CalculationStore::resetMemoizedModelsAfterCalculationIndex(int index) { diff --git a/apps/calculation/calculation_store.h b/apps/calculation/calculation_store.h index 872115649..9f69d3edf 100644 --- a/apps/calculation/calculation_store.h +++ b/apps/calculation/calculation_store.h @@ -28,8 +28,8 @@ class CalculationStore { public: CalculationStore(); Shared::ExpiringPointer calculationAtIndex(int i); - typedef KDCoordinate (*CalculationHeight)(Calculation * c, bool expanded); - Shared::ExpiringPointer push(const char * text, Poincare::Context * context, CalculationHeight height); + typedef KDCoordinate (*HeightComputer)(Calculation * c, bool expanded); + Shared::ExpiringPointer push(const char * text, Poincare::Context * context, HeightComputer heightComputer); void deleteCalculationAtIndex(int i); void deleteAll(); int numberOfCalculations() const { return m_numberOfCalculations; } @@ -61,7 +61,7 @@ private: char * slideCalculationsToEndOfBuffer(); // returns the new position of the calculations size_t deleteLastCalculation(const char * calculationsStart = nullptr); const char * lastCalculationPosition(const char * calculationsStart) const; - Shared::ExpiringPointer emptyStoreAndPushUndef(Poincare::Context * context, CalculationHeight height); + Shared::ExpiringPointer emptyStoreAndPushUndef(Poincare::Context * context, HeightComputer heightComputer); char m_buffer[k_bufferSize]; const char * m_bufferEnd;