summaryrefslogtreecommitdiff
path: root/python/types.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2018-10-17 17:37:15 -0400
committerPeter LaFosse <peter@vector35.com>2018-10-19 10:05:09 -0400
commit4bb4a2016d90176938bc8737fd9f29e2d6ea2737 (patch)
treec3a4f4573fbceafd1eb07cf0a7beaea528c79d83 /python/types.py
parent8de8bad6f2f5517d858568a9871dd99f7e8d5d4b (diff)
Expose DataRender APIs, allow setting const on types, and allow type comparison
Diffstat (limited to 'python/types.py')
-rw-r--r--python/types.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/python/types.py b/python/types.py
index c7ebaf19..4de55700 100644
--- a/python/types.py
+++ b/python/types.py
@@ -266,12 +266,12 @@ class Type(object):
def __eq__(self, value):
if not isinstance(value, Type):
return False
- return ctypes.addressof(self.handle.contents) == ctypes.addressof(value.handle.contents)
+ return core.BNTypesEqual(self.handle, value.handle)
def __ne__(self, value):
if not isinstance(value, Type):
return True
- return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents)
+ return core.BNTypesNotEqual(self.handle, value.handle)
@property
def type_class(self):
@@ -300,6 +300,16 @@ class Type(object):
result = core.BNIsTypeConst(self.handle)
return BoolWithConfidence(result.value, confidence = result.confidence)
+ @const.setter
+ def const(self, value):
+ bc = core.BNBoolWithConfidence()
+ bc.value = bool(value)
+ if hasattr(value, 'confidence'):
+ bc.confidence = value.confidence
+ else:
+ bc.confidence = max_confidence
+ core.BNTypeSetConst(self.handle, bc)
+
@property
def modified(self):
"""Whether type is modified (read-only)"""