summaryrefslogtreecommitdiff
path: root/python/settings.py
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2019-06-08 23:46:19 -0400
committerJordan Wiens <jordan@psifertex.com>2019-06-08 23:46:19 -0400
commit3c7a00172b3b86add668257ca35b873fc85a7017 (patch)
tree73fa2eadacb5b8722258c159076bf48082eb607e /python/settings.py
parentef4e70f68d8c0855bcc64ad49f8f47a78dd3552a (diff)
final refactor for missing parameters
Diffstat (limited to 'python/settings.py')
-rw-r--r--python/settings.py53
1 files changed, 29 insertions, 24 deletions
diff --git a/python/settings.py b/python/settings.py
index 92136460..b16e9763 100644
--- a/python/settings.py
+++ b/python/settings.py
@@ -31,7 +31,12 @@ from binaryninja.enums import SettingsScope
class Settings(object):
def __init__(self, registry_id = "default"):
- self.registry_id = registry_id
+ self._registry_id = registry_id
+
+ @property
+ def registry_id(self):
+ """(read-only)"""
+ return self._registry_id
def register_group(self, group, title):
"""
@@ -47,7 +52,7 @@ class Settings(object):
True
>>>
"""
- return core.BNSettingsRegisterGroup(self.registry_id, group, title)
+ return core.BNSettingsRegisterGroup(self._registry_id, group, title)
def register_setting(self, id, properties):
"""
@@ -64,11 +69,11 @@ class Settings(object):
>>> Settings().register_setting("solver.basicBlockSlicing", '{"description" : "Enable the basic block slicing in the solver.", "title" : "Basic Block Slicing", "default" : true, "type" : "boolean", "id" : "basicBlockSlicing"}')
True
"""
- return core.BNSettingsRegisterSetting(self.registry_id, id, properties)
+ return core.BNSettingsRegisterSetting(self._registry_id, id, properties)
def query_property_string_list(self, id, property_name):
length = ctypes.c_ulonglong()
- result = core.BNSettingsQueryPropertyStringList(self.registry_id, id, property_name, ctypes.byref(length))
+ result = core.BNSettingsQueryPropertyStringList(self._registry_id, id, property_name, ctypes.byref(length))
out_list = []
for i in range(length.value):
out_list.append(pyNativeStr(result[i]))
@@ -76,49 +81,49 @@ class Settings(object):
return out_list
def update_property(self, id, setting_property):
- return core.BNSettingsUpdateProperty(self.registry_id, tr(), id, setting_property)
+ return core.BNSettingsUpdateProperty(self._registry_id, tr(), id, setting_property)
def get_schema(self):
- return core.BNSettingsGetSchema(self.registry_id)
+ return core.BNSettingsGetSchema(self._registry_id)
def copy_value(self, dest_registry_id, id):
- return core.BNSettingsCopyValue(self.registry_id, dest_registry_id, id)
+ return core.BNSettingsCopyValue(self._registry_id, dest_registry_id, id)
def reset(self, id, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
- return core.BNSettingsReset(self.registry_id, id, view, scope)
+ return core.BNSettingsReset(self._registry_id, id, view, scope)
def reset_all(self, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
- return core.BNSettingsResetAll(self.registry_id, view, scope)
+ return core.BNSettingsResetAll(self._registry_id, view, scope)
def get_bool(self, id, view = None):
if view is not None:
view = view.handle
- return core.BNSettingsGetBool(self.registry_id, id, view, None)
+ return core.BNSettingsGetBool(self._registry_id, id, view, None)
def get_double(self, id, view = None):
if view is not None:
view = view.handle
- return core.BNSettingsGetDouble(self.registry_id, id, view, None)
+ return core.BNSettingsGetDouble(self._registry_id, id, view, None)
def get_integer(self, id, view = None):
if view is not None:
view = view.handle
- return core.BNSettingsGetUInt64(self.registry_id, id, view, None)
+ return core.BNSettingsGetUInt64(self._registry_id, id, view, None)
def get_string(self, id, view = None):
if view is not None:
view = view.handle
- return core.BNSettingsGetString(self.registry_id, id, view, None)
+ return core.BNSettingsGetString(self._registry_id, id, view, None)
def get_string_list(self, id, view = None):
if view is not None:
view = view.handle
length = ctypes.c_ulonglong()
- result = core.BNSettingsGetStringList(self.registry_id, id, view, None, ctypes.byref(length))
+ result = core.BNSettingsGetStringList(self._registry_id, id, view, None, ctypes.byref(length))
out_list = []
for i in range(length.value):
out_list.append(pyNativeStr(result[i]))
@@ -129,28 +134,28 @@ class Settings(object):
if view is not None:
view = view.handle
c_scope = core.SettingsScopeEnum(scope)
- result = core.BNSettingsGetBool(self.registry_id, id, view, ctypes.byref(c_scope))
+ result = core.BNSettingsGetBool(self._registry_id, id, view, ctypes.byref(c_scope))
return (result, SettingsScope(c_scope.value))
def get_double_with_scope(self, id, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
c_scope = core.SettingsScopeEnum(scope)
- result = core.BNSettingsGetDouble(self.registry_id, id, view, ctypes.byref(c_scope))
+ result = core.BNSettingsGetDouble(self._registry_id, id, view, ctypes.byref(c_scope))
return (result, SettingsScope(c_scope.value))
def get_integer_with_scope(self, id, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
c_scope = core.SettingsScopeEnum(scope)
- result = core.BNSettingsGetUInt64(self.registry_id, id, view, ctypes.byref(c_scope))
+ result = core.BNSettingsGetUInt64(self._registry_id, id, view, ctypes.byref(c_scope))
return (result, SettingsScope(c_scope.value))
def get_string_with_scope(self, id, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
c_scope = core.SettingsScopeEnum(scope)
- result = core.BNSettingsGetString(self.registry_id, id, view, ctypes.byref(c_scope))
+ result = core.BNSettingsGetString(self._registry_id, id, view, ctypes.byref(c_scope))
return (result, SettingsScope(c_scope.value))
def get_string_list_with_scope(self, id, view = None, scope = SettingsScope.SettingsAutoScope):
@@ -158,7 +163,7 @@ class Settings(object):
view = view.handle
c_scope = core.SettingsScopeEnum(scope)
length = ctypes.c_ulonglong()
- result = core.BNSettingsGetStringList(self.registry_id, id, view, ctypes.byref(c_scope), ctypes.byref(length))
+ result = core.BNSettingsGetStringList(self._registry_id, id, view, ctypes.byref(c_scope), ctypes.byref(length))
out_list = []
for i in range(length.value):
out_list.append(pyNativeStr(result[i]))
@@ -168,22 +173,22 @@ class Settings(object):
def set_bool(self, id, value, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
- return core.BNSettingsSetBool(self.registry_id, view, scope, id, value)
+ return core.BNSettingsSetBool(self._registry_id, view, scope, id, value)
def set_double(self, id, value, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
- return core.BNSettingsSetDouble(self.registry_id, view, scope, id, value)
+ return core.BNSettingsSetDouble(self._registry_id, view, scope, id, value)
def set_integer(self, id, value, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
- return core.BNSettingsSetUInt64(self.registry_id, view, scope, id, value)
+ return core.BNSettingsSetUInt64(self._registry_id, view, scope, id, value)
def set_string(self, id, value, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
view = view.handle
- return core.BNSettingsSetString(self.registry_id, view, scope, id, value)
+ return core.BNSettingsSetString(self._registry_id, view, scope, id, value)
def set_string_list(self, id, value, view = None, scope = SettingsScope.SettingsAutoScope):
if view is not None:
@@ -193,4 +198,4 @@ class Settings(object):
string_list = (ctypes.c_char_p * len(value))()
for i in range(len(value)):
string_list[i] = value[i].encode('charmap')
- return core.BNSettingsSetStringList(self.registry_id, view, scope, id, string_list, length)
+ return core.BNSettingsSetStringList(self._registry_id, view, scope, id, string_list, length)