diff options
| author | Josh F <josh@vector35.com> | 2022-07-04 19:29:48 -0400 |
|---|---|---|
| committer | Josh F <josh@vector35.com> | 2022-07-04 19:29:48 -0400 |
| commit | 9d35fc4b596df313b99d0c4924f54228f5910f32 (patch) | |
| tree | a6399409f81cb3b9404a8fa078174bdbee2a42f2 /filemetadata.cpp | |
| parent | 1c436100642605add5f746ee1c31590f8328b270 (diff) | |
Add CanUndo,CanRedo,GetRedoEntries
Diffstat (limited to 'filemetadata.cpp')
| -rw-r--r-- | filemetadata.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/filemetadata.cpp b/filemetadata.cpp index cdcee292..9d9b2a3a 100644 --- a/filemetadata.cpp +++ b/filemetadata.cpp @@ -317,12 +317,24 @@ void FileMetadata::CommitUndoActions() } +bool FileMetadata::CanUndo() +{ + return BNCanUndo(m_object); +} + + bool FileMetadata::Undo() { return BNUndo(m_object); } +bool FileMetadata::CanRedo() +{ + return BNCanRedo(m_object); +} + + bool FileMetadata::Redo() { return BNRedo(m_object); @@ -369,6 +381,32 @@ vector<UndoEntry> FileMetadata::GetUndoEntries() } +vector<UndoEntry> FileMetadata::GetRedoEntries() +{ + size_t numEntries; + BNUndoEntry* entries = BNGetRedoEntries(m_object, &numEntries); + + vector<UndoEntry> result; + result.reserve(numEntries); + for (size_t i = 0; i < numEntries; i++) + { + UndoEntry temp; + temp.timestamp = entries[i].timestamp; + temp.hash = entries[i].hash; + temp.user = new User(BNNewUserReference(entries[i].user)); + size_t actionCount = entries[i].actionCount; + for (size_t actionIndex = 0; actionIndex < actionCount; actionIndex++) + { + temp.actions.emplace_back(entries[i].actions[actionIndex]); + } + result.push_back(temp); + } + + // BNFreeUndoEntries(entries, count); + return result; +} + + void FileMetadata::ClearUndoEntries() { BNClearUndoEntries(m_object); |
