summaryrefslogtreecommitdiff
path: root/settings.cpp
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2022-01-27 22:43:28 -0500
committerKyleMiles <krm504@nyu.edu>2022-01-28 00:24:06 -0500
commit6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 (patch)
treedace4156d03148bcaf02df138ab4e0d93e61bc6f /settings.cpp
parent519c9db22367f2659d1a54599fab47e6313be06e (diff)
Format All Files
Diffstat (limited to 'settings.cpp')
-rw-r--r--settings.cpp33
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;
}