1 /* 2 * Copyright (C) 2010-2015 Paul Davis <paul@linuxaudiosystems.com> 3 * Copyright (C) 2010 Carl Hetherington <carl@carlh.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #ifndef __pbd_stateful_diff_command_h__ 21 #define __pbd_stateful_diff_command_h__ 22 23 #include <boost/shared_ptr.hpp> 24 #include <boost/weak_ptr.hpp> 25 26 #include "pbd/command.h" 27 #include "pbd/libpbd_visibility.h" 28 29 namespace PBD 30 { 31 class StatefulDestructible; 32 class PropertyList; 33 34 /** A Command which stores its action as the differences between the before and after 35 * state of a Stateful object. 36 */ 37 class LIBPBD_API StatefulDiffCommand : public Command 38 { 39 public: 40 StatefulDiffCommand (boost::shared_ptr<StatefulDestructible>); 41 StatefulDiffCommand (boost::shared_ptr<StatefulDestructible>, XMLNode const&); 42 ~StatefulDiffCommand (); 43 44 void operator() (); 45 void undo (); 46 47 XMLNode& get_state (); 48 49 bool empty () const; 50 51 private: 52 boost::weak_ptr<Stateful> _object; ///< the object in question 53 PBD::PropertyList* _changes; ///< property changes to execute this command 54 }; 55 56 }; // namespace PBD 57 58 #endif /* __pbd_stateful_diff_command_h__ */ 59