MeshLib C++ Docs
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{
10
11
15{
16public:
18 HistoryAction() = default;
19 HistoryAction( const HistoryAction & ) = default;
20 HistoryAction( HistoryAction && ) noexcept = default;
21
22 virtual ~HistoryAction() = default;
23
24 virtual std::string name() const = 0;
25
26 enum class Type
27 {
30 };
31
32 virtual void action( Type actionType ) = 0;
33
35 [[nodiscard]] virtual size_t heapBytes() const = 0;
36};
37
38using HistoryStackFilter = std::function<bool( const std::shared_ptr<HistoryAction>& )>;
39using HistoryActionsVector = std::vector<std::shared_ptr<HistoryAction>>;
40
47MRMESH_API std::pair<bool, int> filterHistoryActionsVector( HistoryActionsVector& historyVector,
48 HistoryStackFilter filteringCondition, size_t firstRedoIndex = 0, bool deepFiltering = true );
49
50}
#define MRMESH_API
Definition MRMeshFwd.h:82
HistoryAction(const HistoryAction &)=default
HistoryAction(HistoryAction &&) noexcept=default
std::function< bool(const std::shared_ptr< HistoryAction > &)> HistoryStackFilter
Definition MRHistoryAction.h:38
std::vector< std::shared_ptr< HistoryAction > > HistoryActionsVector
Definition MRHistoryAction.h:39
virtual std::string name() const =0
Type
Definition MRHistoryAction.h:27
virtual size_t heapBytes() const =0
returns the amount of memory this object occupies on heap
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.
HistoryAction()=default
explicitly define ctors to avoid warning C5267: definition of implicit copy constructor is deprecated...
virtual void action(Type actionType)=0
This function is called on history action (undo, redo, etc.)
@ Undo
Definition MRHistoryAction.h:28
@ Redo
Definition MRHistoryAction.h:29
only for bindings generation
Definition MRCameraOrientationPlugin.h:8