diff options
Diffstat (limited to 'settings.cpp')
| -rw-r--r-- | settings.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/settings.cpp b/settings.cpp index e963a6d1..5c244435 100644 --- a/settings.cpp +++ b/settings.cpp @@ -73,7 +73,8 @@ vector<string> Settings::Keys() } -template<> vector<string> Settings::QueryProperty<vector<string>>(const string& key, const string& property) +template <> +vector<string> Settings::QueryProperty<vector<string>>(const string& key, const string& property) { size_t size = 0; char** outBuffer = (char**)BNSettingsQueryPropertyStringList(m_object, key.c_str(), property.c_str(), &size); @@ -136,7 +137,8 @@ bool Settings::UpdateProperty(const std::string& key, const std::string& propert } -bool Settings::UpdateProperty(const std::string& key, const std::string& property, const std::vector<std::string>& value) +bool Settings::UpdateProperty( + const std::string& key, const std::string& property, const std::vector<std::string>& value) { char** buffer = new char*[value.size()]; if (!buffer) @@ -145,7 +147,8 @@ bool Settings::UpdateProperty(const std::string& key, const std::string& propert for (size_t i = 0; i < value.size(); i++) buffer[i] = BNAllocString(value[i].c_str()); - bool result = BNSettingsUpdateStringListProperty(m_object, key.c_str(), property.c_str(), (const char**)buffer, value.size()); + bool result = + BNSettingsUpdateStringListProperty(m_object, key.c_str(), property.c_str(), (const char**)buffer, value.size()); BNFreeStringList(buffer, value.size()); return result; } @@ -193,31 +196,36 @@ bool Settings::ResetAll(Ref<BinaryView> view, BNSettingsScope scope, bool schema } -template<> bool Settings::Get<bool>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) +template <> +bool Settings::Get<bool>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) { return BNSettingsGetBool(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope); } -template<> double Settings::Get<double>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) +template <> +double Settings::Get<double>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) { return BNSettingsGetDouble(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope); } -template<> int64_t Settings::Get<int64_t>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) +template <> +int64_t Settings::Get<int64_t>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) { return BNSettingsGetInt64(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope); } -template<> uint64_t Settings::Get<uint64_t>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) +template <> +uint64_t Settings::Get<uint64_t>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) { return BNSettingsGetUInt64(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope); } -template<> string Settings::Get<string>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) +template <> +string Settings::Get<string>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) { char* tmpStr = BNSettingsGetString(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope); string result(tmpStr); @@ -226,10 +234,12 @@ template<> string Settings::Get<string>(const string& key, Ref<BinaryView> view, } -template<> vector<string> Settings::Get<vector<string>>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) +template <> +vector<string> Settings::Get<vector<string>>(const string& key, Ref<BinaryView> view, BNSettingsScope* scope) { size_t size = 0; - char** outBuffer = (char**)BNSettingsGetStringList(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope, &size); + char** outBuffer = + (char**)BNSettingsGetStringList(m_object, key.c_str(), view ? view->GetObject() : nullptr, scope, &size); vector<string> result; result.reserve(size); @@ -301,7 +311,8 @@ bool Settings::Set(const string& key, const vector<string>& value, Ref<BinaryVie for (size_t i = 0; i < value.size(); i++) buffer[i] = BNAllocString(value[i].c_str()); - bool result = BNSettingsSetStringList(m_object, view ? view->GetObject() : nullptr, scope, key.c_str(), (const char**)buffer, value.size()); + bool result = BNSettingsSetStringList( + m_object, view ? view->GetObject() : nullptr, scope, key.c_str(), (const char**)buffer, value.size()); BNFreeStringList(buffer, value.size()); return result; } |
