MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / getNActions

Method getNActions

source/MRViewer/MRHistoryStore.cpp:114–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114std::vector<std::string> HistoryStore::getNActions( unsigned n, HistoryAction::Type type ) const
115{
116 if ( type == HistoryAction::Type::Undo )
117 n = std::min( unsigned( firstRedoIndex_ ), n );
118 else if ( type == HistoryAction::Type::Redo )
119 n = std::min( unsigned( stack_.size() - firstRedoIndex_ ), n );
120 std::vector<std::string> res( n );
121 for ( unsigned i = 0; i < n; ++i )
122 {
123 std::shared_ptr<HistoryAction> action;
124 if ( type == HistoryAction::Type::Undo )
125 action = stack_[firstRedoIndex_ - 1 - i];
126 else if ( type == HistoryAction::Type::Redo )
127 action = stack_[firstRedoIndex_ + i];
128 if ( action )
129 {
130 if ( auto dynName = getDynamicName( action ) )
131 res[i] = *dynName;
132 else
133 res[i] = action->name();
134 }
135 }
136 return res;
137}
138
139std::shared_ptr<HistoryAction> HistoryStore::getLastAction( HistoryAction::Type type ) const
140{

Callers 2

updateUndoListCache_Method · 0.80
updateRedoListCache_Method · 0.80

Calls 4

minFunction · 0.85
getDynamicNameFunction · 0.85
sizeMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected