From 46b26cf9f4a8eee8e94f86532220e61120c2a54d Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Tue, 20 Aug 2024 14:27:35 -0400 Subject: Initial support for per-function settings. --- binaryninjaapi.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index eed15ac4..3f0ec438 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -16191,6 +16191,28 @@ namespace BinaryNinja { BNSettingsScope scope = SettingsAutoScope); bool SetJson(const std::string& key, const std::string& value, Ref view = nullptr, BNSettingsScope scope = SettingsAutoScope); + + // Function Settings + bool DeserializeSettings(const std::string& contents, Ref func, BNSettingsScope scope = SettingsAutoScope); + std::string SerializeSettings(Ref func, BNSettingsScope scope = SettingsAutoScope); + + bool Reset(const std::string& key, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool ResetAll(Ref func, BNSettingsScope scope = SettingsAutoScope, bool schemaOnly = true); + + template + T Get(const std::string& key, Ref func, BNSettingsScope* scope = nullptr); + + std::string GetJson(const std::string& key, Ref func, BNSettingsScope* scope = nullptr); + + bool Set(const std::string& key, bool value, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool Set(const std::string& key, double value, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool Set(const std::string& key, int value, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool Set(const std::string& key, int64_t value, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool Set(const std::string& key, uint64_t value, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool Set(const std::string& key, const char* value, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool Set(const std::string& key, const std::string& value, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool Set(const std::string& key, const std::vector& value, Ref func, BNSettingsScope scope = SettingsAutoScope); + bool SetJson(const std::string& key, const std::string& value, Ref func, BNSettingsScope scope = SettingsAutoScope); }; // explicit specializations @@ -16215,6 +16237,19 @@ namespace BinaryNinja { const std::string& key, Ref view, BNSettingsScope* scope); /*! \endcond*/ + template <> + bool Settings::Get(const std::string& key, Ref func, BNSettingsScope* scope); + template <> + double Settings::Get(const std::string& key, Ref func, BNSettingsScope* scope); + template <> + int64_t Settings::Get(const std::string& key, Ref func, BNSettingsScope* scope); + template <> + uint64_t Settings::Get(const std::string& key, Ref func, BNSettingsScope* scope); + template <> + std::string Settings::Get(const std::string& key, Ref func, BNSettingsScope* scope); + template <> + std::vector Settings::Get>(const std::string& key, Ref func, BNSettingsScope* scope); + typedef BNMetadataType MetadataType; /*! DataRenderer objects tell the Linear View how to render specific types. -- cgit v1.3.1