| 112 | } |
| 113 | |
| 114 | std::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 | |
| 139 | std::shared_ptr<HistoryAction> HistoryStore::getLastAction( HistoryAction::Type type ) const |
| 140 | { |
no test coverage detected