diff options
| author | Glenn Smith <glenn@vector35.com> | 2022-12-09 18:39:33 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2023-01-03 15:01:32 -0500 |
| commit | 0cee5e43068d433e55995ba95994c35c73cb2b4f (patch) | |
| tree | d8d6252e487386a9b2d66b798bcc8e5489e2d1ac | |
| parent | ffafa54703d239414e616d88633736ced71b63a5 (diff) | |
Add Snapshot::SetName api
| -rw-r--r-- | binaryninjaapi.h | 1 | ||||
| -rw-r--r-- | binaryninjacore.h | 1 | ||||
| -rw-r--r-- | database.cpp | 6 | ||||
| -rw-r--r-- | python/database.py | 7 |
4 files changed, 14 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index dfd5ecb5..e0784e8d 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1544,6 +1544,7 @@ namespace BinaryNinja { Ref<Database> GetDatabase(); int64_t GetId(); std::string GetName(); + void SetName(const std::string& name); bool IsAutoSave(); bool HasContents(); bool HasData(); diff --git a/binaryninjacore.h b/binaryninjacore.h index ee4931b3..abd2a1d0 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -3200,6 +3200,7 @@ extern "C" BINARYNINJACOREAPI BNSnapshot** BNGetSnapshotParents(BNSnapshot* snapshot, size_t* count); BINARYNINJACOREAPI BNSnapshot** BNGetSnapshotChildren(BNSnapshot* snapshot, size_t* count); BINARYNINJACOREAPI char* BNGetSnapshotName(BNSnapshot* snapshot); + BINARYNINJACOREAPI void BNSetSnapshotName(BNSnapshot* snapshot, const char* name); BINARYNINJACOREAPI bool BNIsSnapshotAutoSave(BNSnapshot* snapshot); BINARYNINJACOREAPI bool BNSnapshotHasContents(BNSnapshot* snapshot); BINARYNINJACOREAPI bool BNSnapshotHasUndo(BNSnapshot* snapshot); diff --git a/database.cpp b/database.cpp index e60e0d92..4f284f15 100644 --- a/database.cpp +++ b/database.cpp @@ -193,6 +193,12 @@ std::string Snapshot::GetName() } +void Snapshot::SetName(const std::string& name) +{ + BNSetSnapshotName(m_object, name.c_str()); +} + + bool Snapshot::IsAutoSave() { return BNIsSnapshotAutoSave(m_object); diff --git a/python/database.py b/python/database.py index 226079ab..c19ab565 100644 --- a/python/database.py +++ b/python/database.py @@ -140,9 +140,14 @@ class Snapshot: @property def name(self) -> str: - """Get the displayed snapshot name (read-only)""" + """Get the displayed snapshot name""" return core.BNGetSnapshotName(self.handle) + @name.setter + def name(self, value: str) -> None: + """Set the displayed snapshot name""" + core.BNSetSnapshotName(self.handle, value) + @property def is_auto_save(self) -> bool: """If the snapshot was the result of an auto-save (read-only)""" |
