def __getitem__(self, name): try: member = core.BNGetStructureMemberByName(self.handle, name) return StructureMember(Type(core.BNNewTypeReference(member.contents.type), confidence=member.contents.typeConfidence), member.contents.name, member.contents.offset) finally: core.BNFreeStructureMember(member)
def member_at_offset(self, offset): try: if self._mutable: member = core.BNGetStructureBuilderMemberAtOffset(self._handle, offset, None) else: member = core.BNGetStructureMemberAtOffset(self._handle, offset, None) return StructureMember(Type(core.BNNewTypeReference(member.contents.type), confidence=member.contents.typeConfidence), member.contents.name, member.contents.offset) finally: core.BNFreeStructureMember(member)