From 5b289d30061a5b82b7c9dfb5a69b06c4da4b69ba Mon Sep 17 00:00:00 2001 From: Hans Fugal Date: Thu, 29 Jun 2006 18:45:41 +0000 Subject: [PATCH] r115@gandalf: fugalh | 2006-06-23 12:36:05 -0600 pass the object instead of an id git-svn-id: svn://localhost/ardour2/branches/undo@654 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd3/pbd/undo_command.h | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/libs/pbd3/pbd/undo_command.h b/libs/pbd3/pbd/undo_command.h index 26550650be..1c9cac7684 100644 --- a/libs/pbd3/pbd/undo_command.h +++ b/libs/pbd3/pbd/undo_command.h @@ -38,7 +38,7 @@ using std::string; /* One of the joys of templates is that you have to do everything right here * in the header file; you can't split this to make undo_command.cc */ -template +template class UndoCommand { public: @@ -47,39 +47,39 @@ class UndoCommand * * UndoCommand cmd(id, key, foo_instance); */ - UndoCommand(id_t object_id, string key) - : _obj_id(object_id), _key(key) + UndoCommand(T_obj &object, string key) + : _obj(object), _key(key) { - _slot = mem_fun( get_object(object_id), get_method(key) ); + _slot = mem_fun( _obj, get_method(_key) ); } - UndoCommand(id_t object_id, string key, T1 &arg1) - : _obj_id(object_id), _key(key) + UndoCommand(T_obj &object, string key, T1 &arg1) + : _obj(object), _key(key) { - _slot = bind( mem_fun( get_object(object_id), get_method(key) ), + _slot = bind( mem_fun( _obj, get_method(_key) ), arg1); _args.push_back(&arg1); } - UndoCommand(id_t object_id, string key, T1 &arg1, T2 &arg2) - : _obj_id(object_id), _key(key) + UndoCommand(T_obj &object, string key, T1 &arg1, T2 &arg2) + : _obj(object), _key(key) { - _slot = bind( mem_fun( get_object(object_id), get_method(key) ), + _slot = bind( mem_fun( _obj, get_method(_key) ), arg1, arg2); _args.push_back(&arg1); _args.push_back(&arg2); } - UndoCommand(id_t object_id, string key, T1 &arg1, T2 &arg2, T3 &arg3) - : _obj_id(object_id), _key(key) + UndoCommand(T_obj &object, string key, T1 &arg1, T2 &arg2, T3 &arg3) + : _obj(object), _key(key) { - _slot = bind( mem_fun( get_object(object_id), get_method(key) ), + _slot = bind( mem_fun( _obj, get_method(_key) ), arg1, arg2, arg3); _args.push_back(&arg1); _args.push_back(&arg2); _args.push_back(&arg3); } - UndoCommand(id_t object_id, string key, T1 &arg1, T2 &arg2, T3 &arg3, T4 &arg4) - : _obj_id(object_id), _key(key) + UndoCommand(T_obj &object, string key, T1 &arg1, T2 &arg2, T3 &arg3, T4 &arg4) + : _obj(object), _key(key) { - _slot = bind( mem_fun( get_object(object_id), get_method(key) ), + _slot = bind( mem_fun( _obj, get_method(_key) ), arg1, arg2, arg4); _args.push_back(&arg1); _args.push_back(&arg2); @@ -91,9 +91,8 @@ class UndoCommand XMLNode &serialize(); protected: - template T_object &get_object(id_t); template T_method &get_method(string); - id_t _obj_id; + T_obj &_obj; string _key; slot _slot;