From 5b9c47a16f30c36e5ba992c72b50984d2be2c4fc Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Wed, 21 Nov 2018 18:43:14 -0500 Subject: Add ability to serialize/deserialize settings from BinaryViews. --- settings.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'settings.cpp') diff --git a/settings.cpp b/settings.cpp index 62425f5b..df95a56c 100644 --- a/settings.cpp +++ b/settings.cpp @@ -90,6 +90,21 @@ string Settings::GetSchema() } +bool Settings::DeserializeSettings(const string& contents, Ref view, BNSettingsScope scope) +{ + return BNDeserializeSettings(m_registry.c_str(), contents.c_str(), view ? view->GetObject() : nullptr, scope); +} + + +string Settings::SerializeSettings(Ref view, BNSettingsScope scope) +{ + char* settingsStr = BNSerializeSettings(m_registry.c_str(), view ? view->GetObject() : nullptr, scope); + string settings(settingsStr); + BNFreeString(settingsStr); + return settings; +} + + bool Settings::Reset(const string& id, Ref view, BNSettingsScope scope) { return BNSettingsReset(m_registry.c_str(), id.c_str(), view ? view->GetObject() : nullptr, scope); -- cgit v1.3.1