From bac2b01e488e6a58dd3d16d6148dc5bea16be162 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 14 Sep 2022 16:31:04 -0400 Subject: Optimized api for getting the title of the last undo entry --- filemetadata.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'filemetadata.cpp') diff --git a/filemetadata.cpp b/filemetadata.cpp index 5d01c3b0..9b1dfee3 100644 --- a/filemetadata.cpp +++ b/filemetadata.cpp @@ -453,6 +453,32 @@ std::optional FileMetadata::GetLastRedoEntry() } +std::optional FileMetadata::GetLastUndoEntryTitle() +{ + char* title = BNGetLastUndoEntryTitle(m_object); + if (!title) + { + return std::nullopt; + } + std::string titleStr = title; + BNFreeString(title); + return titleStr; +} + + +std::optional FileMetadata::GetLastRedoEntryTitle() +{ + char* title = BNGetLastRedoEntryTitle(m_object); + if (!title) + { + return std::nullopt; + } + std::string titleStr = title; + BNFreeString(title); + return titleStr; +} + + void FileMetadata::ClearUndoEntries() { BNClearUndoEntries(m_object); -- cgit v1.3.1