MeshLib Documentation
Loading...
Searching...
No Matches
MRHistoryAction.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include <functional>
4#include <string>
5
6namespace MR
7{
8
12{
13public:
14 virtual ~HistoryAction() = default;
15
16 virtual std::string name() const = 0;
17
18 enum class Type
19 {
20 Undo,
21 Redo
22 };
24 virtual void action( Type actionType ) = 0;
25
27 [[nodiscard]] virtual size_t heapBytes() const = 0;
28};
29
30using HistoryStackFilter = std::function<bool( const std::shared_ptr<HistoryAction>& )>;
31using HistoryActionsVector = std::vector<std::shared_ptr<HistoryAction>>;
32
39MRMESH_API std::pair<bool, int> filterHistoryActionsVector( HistoryActionsVector& historyVector,
40 HistoryStackFilter filteringCondition, size_t firstRedoIndex = 0, bool deepFiltering = true );
41
42} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRHistoryAction.h:12
virtual ~HistoryAction()=default
virtual std::string name() const =0
Type
Definition MRHistoryAction.h:19
virtual size_t heapBytes() const =0
returns the amount of memory this object occupies on heap
virtual void action(Type actionType)=0
This function is called on history action (undo, redo, etc.)
Definition MRCameraOrientationPlugin.h:8
std::function< bool(const std::shared_ptr< HistoryAction > &)> HistoryStackFilter
Definition MRHistoryAction.h:30
std::vector< std::shared_ptr< HistoryAction > > HistoryActionsVector
Definition MRHistoryAction.h:31
MRMESH_API std::pair< bool, int > filterHistoryActionsVector(HistoryActionsVector &historyVector, HistoryStackFilter filteringCondition, size_t firstRedoIndex=0, bool deepFiltering=true)
Remove actions from history actions vector that match the condition.