aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-20 00:11:36 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-20 06:07:34 +0100
commit9e49e88d0cc3e6336754040eeaab7a760645dd79 (patch)
tree0a71606cabde4b99c3183a744dd16b37e1560ef7
parentf0f420be3d80366a54598f6742ef73114651f3c4 (diff)
undo.push_var() and undo.push_str() return references so calls can be used as l-values (common use case)
-rw-r--r--undo.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/undo.h b/undo.h
index 32bb2d5..43692e9 100644
--- a/undo.h
+++ b/undo.h
@@ -100,28 +100,30 @@ public:
uptr_t wParam = 0, sptr_t lParam = 0);
template <typename Type>
- inline void
+ inline Type &
push_var(Type &variable, Type value)
{
push(new UndoTokenVariable<Type>(variable, value));
+ return variable;
}
template <typename Type>
- inline void
+ inline Type &
push_var(Type &variable)
{
- push_var<Type>(variable, variable);
+ return push_var<Type>(variable, variable);
}
- inline void
+ inline gchar *&
push_str(gchar *&variable, gchar *str)
{
push(new UndoTokenString(variable, str));
+ return variable;
}
- inline void
+ inline gchar *&
push_str(gchar *&variable)
{
- push_str(variable, variable);
+ return push_str(variable, variable);
}
void pop(gint pos);