summaryrefslogtreecommitdiff
path: root/settings.cpp
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2018-11-21 18:43:14 -0500
committerBrian Potchik <brian@vector35.com>2018-11-21 18:43:14 -0500
commit5b9c47a16f30c36e5ba992c72b50984d2be2c4fc (patch)
tree36f1d1ff63720bf0edf8c52bae2572055b487af1 /settings.cpp
parent419a05cf5227029a5fe69799a7f7466a6b60d849 (diff)
Add ability to serialize/deserialize settings from BinaryViews.
Diffstat (limited to 'settings.cpp')
-rw-r--r--settings.cpp15
1 files changed, 15 insertions, 0 deletions
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<BinaryView> view, BNSettingsScope scope)
+{
+ return BNDeserializeSettings(m_registry.c_str(), contents.c_str(), view ? view->GetObject() : nullptr, scope);
+}
+
+
+string Settings::SerializeSettings(Ref<BinaryView> 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<BinaryView> view, BNSettingsScope scope)
{
return BNSettingsReset(m_registry.c_str(), id.c_str(), view ? view->GetObject() : nullptr, scope);