Skip to content

Commit 9124b7b

Browse files
lukbukkitemesare
authored andcommitted
[Rust] Support pointer base types and offsets
1 parent 9e83ea1 commit 9124b7b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

rust/src/types.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub type NamedTypeReferenceClass = BNNamedTypeReferenceClass;
4848
pub type MemberAccess = BNMemberAccess;
4949
pub type MemberScope = BNMemberScope;
5050
pub type IntegerDisplayType = BNIntegerDisplayType;
51+
pub type PointerBaseType = BNPointerBaseType;
5152

5253
#[derive(PartialEq, Eq, Hash)]
5354
pub struct TypeBuilder {
@@ -95,6 +96,11 @@ impl TypeBuilder {
9596
self
9697
}
9798

99+
pub fn set_pointer_base(&self, base_type: PointerBaseType, base_offset: i64) -> &Self {
100+
unsafe { BNSetTypeBuilderPointerBase(self.handle, base_type, base_offset) }
101+
self
102+
}
103+
98104
// Readable properties
99105

100106
pub fn type_class(&self) -> TypeClass {
@@ -231,6 +237,14 @@ impl TypeBuilder {
231237
unsafe { BNGetTypeBuilderStackAdjustment(self.handle).into() }
232238
}
233239

240+
pub fn pointer_base_type(&self) -> PointerBaseType {
241+
unsafe { BNTypeBuilderGetPointerBaseType(self.handle) }
242+
}
243+
244+
pub fn pointer_base_offset(&self) -> i64 {
245+
unsafe { BNTypeBuilderGetPointerBaseOffset(self.handle) }
246+
}
247+
234248
// TODO : This and properties
235249
// pub fn tokens(&self) -> ? {}
236250

@@ -602,6 +616,14 @@ impl Type {
602616
}
603617
}
604618

619+
pub fn pointer_base_type(&self) -> BNPointerBaseType {
620+
unsafe { BNTypeGetPointerBaseType(self.handle) }
621+
}
622+
623+
pub fn pointer_base_offset(&self) -> i64 {
624+
unsafe { BNTypeGetPointerBaseOffset(self.handle) }
625+
}
626+
605627
// TODO : This and properties
606628
// pub fn tokens(&self) -> ? {}
607629

0 commit comments

Comments
 (0)