2010-02-09 14:44:24 +00:00
|
|
|
/*
|
2019-08-03 05:10:55 +02:00
|
|
|
* Copyright (C) 2010-2015 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
|
* Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*/
|
2010-02-09 14:44:24 +00:00
|
|
|
|
2010-02-11 23:10:29 +00:00
|
|
|
#ifndef __pbd_stateful_diff_command_h__
|
|
|
|
|
#define __pbd_stateful_diff_command_h__
|
|
|
|
|
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
#include <boost/weak_ptr.hpp>
|
2013-10-16 23:30:28 -04:00
|
|
|
|
2010-02-09 14:44:24 +00:00
|
|
|
#include "pbd/command.h"
|
2020-02-28 06:08:26 +01:00
|
|
|
#include "pbd/libpbd_visibility.h"
|
2010-02-09 14:44:24 +00:00
|
|
|
|
|
|
|
|
namespace PBD
|
|
|
|
|
{
|
2015-10-05 16:17:49 +02:00
|
|
|
class StatefulDestructible;
|
2013-10-17 10:02:11 -04:00
|
|
|
class PropertyList;
|
2010-02-09 14:44:24 +00:00
|
|
|
|
|
|
|
|
/** A Command which stores its action as the differences between the before and after
|
|
|
|
|
* state of a Stateful object.
|
|
|
|
|
*/
|
2013-10-16 23:30:28 -04:00
|
|
|
class LIBPBD_API StatefulDiffCommand : public Command
|
2010-02-09 14:44:24 +00:00
|
|
|
{
|
|
|
|
|
public:
|
2010-06-23 20:14:07 +00:00
|
|
|
StatefulDiffCommand (boost::shared_ptr<StatefulDestructible>);
|
2020-02-28 06:08:26 +01:00
|
|
|
StatefulDiffCommand (boost::shared_ptr<StatefulDestructible>, XMLNode const&);
|
2010-02-09 14:44:24 +00:00
|
|
|
~StatefulDiffCommand ();
|
|
|
|
|
|
|
|
|
|
void operator() ();
|
|
|
|
|
void undo ();
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2010-02-09 14:44:24 +00:00
|
|
|
XMLNode& get_state ();
|
|
|
|
|
|
2010-08-26 01:44:11 +00:00
|
|
|
bool empty () const;
|
|
|
|
|
|
2010-02-09 14:44:24 +00:00
|
|
|
private:
|
2020-02-28 06:08:26 +01:00
|
|
|
boost::weak_ptr<Stateful> _object; ///< the object in question
|
|
|
|
|
PBD::PropertyList* _changes; ///< property changes to execute this command
|
2010-02-09 14:44:24 +00:00
|
|
|
};
|
|
|
|
|
|
2020-02-28 06:08:26 +01:00
|
|
|
}; // namespace PBD
|
2010-02-11 23:10:29 +00:00
|
|
|
|
|
|
|
|
#endif /* __pbd_stateful_diff_command_h__ */
|