mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/calculation] CalculationStore: change name CalculationHeight -->
HeightComputer
This commit is contained in:
committed by
LeaNumworks
parent
83ecefda00
commit
22549d4d50
@@ -50,7 +50,7 @@ ExpiringPointer<Calculation> CalculationStore::calculationAtIndex(int i) {
|
||||
return calculationAtIndex(i);
|
||||
}
|
||||
|
||||
ExpiringPointer<Calculation> CalculationStore::push(const char * text, Context * context, CalculationHeight height) {
|
||||
ExpiringPointer<Calculation> 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<Calculation> 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<Calculation> 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<Calculation> 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<const char *>(c);
|
||||
}
|
||||
|
||||
Shared::ExpiringPointer<Calculation> CalculationStore::emptyStoreAndPushUndef(Context * context, CalculationHeight height) {
|
||||
Shared::ExpiringPointer<Calculation> 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) {
|
||||
|
||||
@@ -28,8 +28,8 @@ class CalculationStore {
|
||||
public:
|
||||
CalculationStore();
|
||||
Shared::ExpiringPointer<Calculation> calculationAtIndex(int i);
|
||||
typedef KDCoordinate (*CalculationHeight)(Calculation * c, bool expanded);
|
||||
Shared::ExpiringPointer<Calculation> push(const char * text, Poincare::Context * context, CalculationHeight height);
|
||||
typedef KDCoordinate (*HeightComputer)(Calculation * c, bool expanded);
|
||||
Shared::ExpiringPointer<Calculation> 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<Calculation> emptyStoreAndPushUndef(Poincare::Context * context, CalculationHeight height);
|
||||
Shared::ExpiringPointer<Calculation> emptyStoreAndPushUndef(Poincare::Context * context, HeightComputer heightComputer);
|
||||
|
||||
char m_buffer[k_bufferSize];
|
||||
const char * m_bufferEnd;
|
||||
|
||||
Reference in New Issue
Block a user