diff options
| author | Peter LaFosse <peter@vector35.com> | 2017-05-14 09:41:28 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2017-05-14 10:11:50 -0400 |
| commit | 2111f1f77241c938b30bd3cf2851919094429dd6 (patch) | |
| tree | a0201812b8409528b64549295b1fed6bad19e93b /type.cpp | |
| parent | 12d16ae11dd2c0524a36c59c5b025c38edb4135b (diff) | |
Expose some core API's for the demangling and type creation
Diffstat (limited to 'type.cpp')
| -rw-r--r-- | type.cpp | 99 |
1 files changed, 99 insertions, 0 deletions
@@ -279,6 +279,42 @@ bool Type::IsFloat() const } +BNMemberScope Type::GetScope() const +{ + return BNTypeGetMemberScope(m_object); +} + + +void Type::SetScope(BNMemberScope scope) +{ + return BNTypeSetMemberScope(m_object, scope); +} + + +BNMemberAccess Type::GetAccess() const +{ + return BNTypeGetMemberAccess(m_object); +} + + +void Type::SetAccess(BNMemberAccess access) +{ + return BNTypeSetMemberAccess(m_object, access); +} + + +void Type::SetConst(bool cnst) +{ + BNTypeSetConst(m_object, cnst); +} + + +void Type::SetVolatile(bool vltl) +{ + BNTypeSetVolatile(m_object, vltl); +} + + Ref<Type> Type::GetChildType() const { BNType* type = BNGetChildType(m_object); @@ -547,6 +583,12 @@ Ref<Type> Type::PointerType(Architecture* arch, Type* type, bool cnst, bool vltl } +Ref<Type> Type::PointerType(size_t width, Type* type, bool cnst, bool vltl, BNReferenceType refType) +{ + return new Type(BNCreatePointerTypeOfWidth(width, type->GetObject(), cnst, vltl, refType)); +} + + Ref<Type> Type::ArrayType(Type* type, uint64_t elem) { return new Type(BNCreateArrayType(type->GetObject(), elem)); @@ -608,6 +650,43 @@ string Type::GetAutoDemangledTypeIdSource() } +string Type::GenerateAutoDebugTypeId(const QualifiedName& name) +{ + BNQualifiedName nameObj = name.GetAPIObject(); + char* str = BNGenerateAutoDebugTypeId(&nameObj); + string result = str; + QualifiedName::FreeAPIObject(&nameObj); + BNFreeString(str); + return result; +} + + +string Type::GetAutoDebugTypeIdSource() +{ + char* str = BNGetAutoDebugTypeIdSource(); + string result = str; + BNFreeString(str); + return result; +} + + +QualifiedName Type::GetTypeName() const +{ + BNQualifiedName name = BNTypeGetTypeName(m_object); + QualifiedName result = QualifiedName::FromAPIObject(&name); + BNFreeQualifiedName(&name); + return result; +} + + +void Type::SetTypeName(const QualifiedName& names) +{ + BNQualifiedName nameObj = names.GetAPIObject(); + BNTypeSetTypeName(m_object, &nameObj); + QualifiedName::FreeAPIObject(&nameObj); +} + + NamedTypeReference::NamedTypeReference(BNNamedTypeReference* nt) { m_object = nt; @@ -691,12 +770,26 @@ Ref<NamedTypeReference> NamedTypeReference::GenerateAutoDemangledTypeReference(B } +Ref<NamedTypeReference> NamedTypeReference::GenerateAutoDebugTypeReference(BNNamedTypeReferenceClass cls, + const QualifiedName& name) +{ + string id = Type::GenerateAutoDebugTypeId(name); + return new NamedTypeReference(cls, id, name); +} + + Structure::Structure() { m_object = BNCreateStructure(); } +Structure::Structure(BNStructureType type, bool isUnion, bool packed) +{ + m_object = BNCreateStructureWithOptions(type, isUnion, packed); +} + + Structure::Structure(BNStructure* s) { m_object = s; @@ -801,6 +894,12 @@ Enumeration::Enumeration(BNEnumeration* e) } +Enumeration::Enumeration() +{ + m_object = BNCreateEnumeration(); +} + + vector<EnumerationMember> Enumeration::GetMembers() const { size_t count; |
