diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-07 20:12:18 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-07 20:12:18 +0100 |
commit | 2b99d5f24d891b887338af863f78a84a7231a7c1 (patch) | |
tree | a9084d9d786e38d27f588e62728bb27c3c18a2cb /expressions.cpp | |
parent | 99c8e92238986d00557ded56adc8495086d3c631 (diff) | |
download | sciteco-2b99d5f24d891b887338af863f78a84a7231a7c1.tar.gz |
simplified/cleaned up undo operations on value stack
* special undo tokens are private to the ValueStack class and automatically parameterized
* undo_push() and undo_pop() methods hide the internals of pushing the undo tokens
Diffstat (limited to 'expressions.cpp')
-rw-r--r-- | expressions.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/expressions.cpp b/expressions.cpp index 38af2fc..6999312 100644 --- a/expressions.cpp +++ b/expressions.cpp @@ -28,7 +28,7 @@ Expressions::push(gint64 number) push(OP_NUMBER); - undo.push(new UndoTokenPop<gint64>(numbers)); + numbers.undo_pop(); return numbers.push(number); } @@ -40,7 +40,7 @@ Expressions::pop_num(int index) pop_op(); if (numbers.items() > 0) { n = numbers.pop(index); - undo.push(new UndoTokenPush<gint64>(numbers, n, index)); + numbers.undo_push(n, index); } return n; @@ -67,7 +67,7 @@ Expressions::add_digit(gchar digit) Expressions::Operator Expressions::push(Expressions::Operator op) { - undo.push(new UndoTokenPop<Operator>(operators)); + operators.undo_pop(); return operators.push(op); } @@ -90,7 +90,7 @@ Expressions::pop_op(int index) if (operators.items() > 0) { op = operators.pop(index); - undo.push(new UndoTokenPush<Operator>(operators, op, index)); + operators.undo_push(op, index); } return op; |