Use XMLNode::set_property API in PBD::MementoCommand class
[ardour.git] / libs / pbd / pbd / memento_command.h
index d22561ab217985fe8c12d48755518f504a9a139b..7825b2bbb5b4c9910f979511a3c232b8cd0eead9 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
     Copyright (C) 2006 Paul Davis
     Author: Hans Fugal
 
@@ -82,9 +82,9 @@ public:
        }
 
        void add_state (XMLNode* node) {
-               node->add_property ("obj_id", _object.id().to_s());
+               node->set_property ("obj_id", _object.id().to_s());
        }
-       
+
        void object_died () {
                /* The object we are binding died, so drop references to ourselves */
                this->drop_references ();
@@ -95,7 +95,7 @@ private:
        PBD::ScopedConnection _object_death_connection;
 };
 
-/** This command class is initialized with before and after mementos 
+/** This command class is initialized with before and after mementos
  * (from Stateful::get_state()), so undo becomes restoring the before
  * memento, and redo is restoring the after memento.
  */
@@ -103,20 +103,20 @@ template <class obj_T>
 class LIBPBD_TEMPLATE_API MementoCommand : public Command
 {
 public:
-       MementoCommand (obj_T& a_object, XMLNode* a_before, XMLNode* a_after) 
+       MementoCommand (obj_T& a_object, XMLNode* a_before, XMLNode* a_after)
                : _binder (new SimpleMementoCommandBinder<obj_T> (a_object)), before (a_before), after (a_after)
        {
                /* The binder's object died, so we must die */
                _binder->DropReferences.connect_same_thread (_binder_death_connection, boost::bind (&MementoCommand::binder_dying, this));
        }
 
-       MementoCommand (MementoCommandBinder<obj_T>* b, XMLNode* a_before, XMLNode* a_after) 
+       MementoCommand (MementoCommandBinder<obj_T>* b, XMLNode* a_before, XMLNode* a_after)
                : _binder (b), before (a_before), after (a_after)
        {
                /* The binder's object died, so we must die */
                _binder->DropReferences.connect_same_thread (_binder_death_connection, boost::bind (&MementoCommand::binder_dying, this));
        }
-       
+
        ~MementoCommand () {
                drop_references ();
                delete before;
@@ -130,13 +130,13 @@ public:
 
        void operator() () {
                if (after) {
-                       _binder->get()->set_state(*after, Stateful::current_state_version); 
+                       _binder->get()->set_state(*after, Stateful::current_state_version);
                }
        }
 
-       void undo() { 
+       void undo() {
                if (before) {
-                       _binder->get()->set_state(*before, Stateful::current_state_version); 
+                       _binder->get()->set_state(*before, Stateful::current_state_version);
                }
        }
 
@@ -152,13 +152,13 @@ public:
 
                XMLNode* node = new XMLNode(name);
                _binder->add_state (node);
-               
-               node->add_property ("type_name", _binder->type_name ());
+
+               node->set_property ("type_name", _binder->type_name ());
 
                if (before) {
                        node->add_child_copy(*before);
                }
-               
+
                if (after) {
                        node->add_child_copy(*after);
                }