From 4bb4a2016d90176938bc8737fd9f29e2d6ea2737 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Wed, 17 Oct 2018 17:37:15 -0400 Subject: Expose DataRender APIs, allow setting const on types, and allow type comparison --- python/types.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'python/types.py') 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)""" -- cgit v1.3.1