// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** \file
\author Tim Shead (tshead@k-3d.com)
*/
#include "iunknown.h"
#include "signal_system.h"
#include <memory>
#include <string>
#include <vector>
namespace k3d
{
class state_change_set;
/// Abstract interface for an object that can store a hierarchical tree of state changes to the document
class istate_recorder :
public virtual iunknown
{
public:
/// Called by clients to register a change set for recording subsequent state changes (the recorder assumes responsibility for the lifetime of the changeset)
/// Called by clients once a set of changes is complete, to make them a part of the undo/redo tree (the recorder assumes responsibility for the lifetime of the change set)
/// Points to this node's parent (NULL for the root node)
node* const parent;
/// Points to this node's children
nodes_t children;
};
/// Returns the root node(s) in the hierarchy of recorded state changes (could return an empty collection if no recording has taken place)
virtual const nodes_t& root_nodes() = 0;
/// Returns the current node - the node that will become the parent of any subsequently recorded nodes (could return NULL)
virtual const node* current_node() = 0;
/// Returns the newest (most-recently-created) node, which is typically the node that should be the "goal" of redo operations (could return NULL if nothing's been recorded yet)
virtual const node* newest_node() = 0;
/// Returns the most-recently-saved node in the hierarchy of recorded state changes (could return NULL if no save has taken place)