diff options
| author | Glenn Smith <glenn@vector35.com> | 2020-09-14 17:15:37 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2021-07-13 15:04:49 -0400 |
| commit | ce08fff22e4bed3d977cfd662ed2a6d8caa82997 (patch) | |
| tree | 9fed8c3070837f38099d13ff78a7577fbc4ac168 /filemetadata.cpp | |
| parent | 10e668db4d76658882bee7b75d47063b054a730d (diff) | |
Database api
Co-Authored-By: Josh Ferrell <josh@vector35.com>
Diffstat (limited to 'filemetadata.cpp')
| -rw-r--r-- | filemetadata.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/filemetadata.cpp b/filemetadata.cpp index 00711b57..4ca10e64 100644 --- a/filemetadata.cpp +++ b/filemetadata.cpp @@ -223,6 +223,33 @@ bool FileMetadata::SaveAutoSnapshot(BinaryView* data, } +void FileMetadata::GetSnapshotData(Ref<KeyValueStore> data, Ref<KeyValueStore> cache, + const std::function<void(size_t, size_t)>& progress) +{ + DatabaseProgressCallbackContext cb; + cb.func = progress; + BNGetSnapshotData(GetObject(), data->GetObject(), cache->GetObject(), &cb, DatabaseProgressCallback); +} + + +void FileMetadata::ApplySnapshotData(BinaryView* file, Ref<KeyValueStore> data, Ref<KeyValueStore> cache, + const std::function<void(size_t, size_t)>& progress, bool openForConfiguration, bool restoreRawView) +{ + DatabaseProgressCallbackContext cb; + cb.func = progress; + BNApplySnapshotData(GetObject(), file->GetObject(), data->GetObject(), cache->GetObject(), &cb, DatabaseProgressCallback, openForConfiguration, restoreRawView); +} + + +Ref<Database> FileMetadata::GetDatabase() +{ + BNDatabase* db = BNGetFileMetadataDatabase(m_object); + if (db == nullptr) + return nullptr; + return new Database(db); +} + + bool FileMetadata::Rebase(BinaryView* data, uint64_t address) { return BNRebase(data->GetObject(), address); @@ -320,6 +347,12 @@ vector<UndoEntry> FileMetadata::GetUndoEntries() } +void FileMetadata::ClearUndoEntries() +{ + BNClearUndoEntries(m_object); +} + + bool FileMetadata::OpenProject() { return BNOpenProject(m_object); |
