From 0824604746724984472975400443871294158813 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Fri, 10 May 2024 20:01:13 -0400 Subject: Expose Type::PointerSuffix --- type.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'type.cpp') diff --git a/type.cpp b/type.cpp index 3cfa26f9..8731e8ae 100644 --- a/type.cpp +++ b/type.cpp @@ -693,6 +693,36 @@ Confidence Type::GetStackAdjustment() const } +std::set Type::GetPointerSuffix() const +{ + size_t count = 0; + BNPointerSuffix* suffix = BNGetTypePointerSuffix(m_object, &count); + std::set result(suffix, suffix + count); + BNFreePointerSuffixList(suffix, count); + return result; + +} + + +std::string Type::GetPointerSuffixString() const +{ + char* string = BNGetTypePointerSuffixString(m_object); + std::string result(string); + BNFreeString(string); + return result; +} + + +std::vector Type::GetPointerSuffixTokens(uint8_t baseConfidence) const +{ + size_t count = 0; + BNInstructionTextToken* tokens = BNGetTypePointerSuffixTokens(m_object, baseConfidence, &count); + std::vector result = InstructionTextToken::ConvertInstructionTextTokenList(tokens, count); + BNFreeInstructionText(tokens, count); + return result; +} + + string Type::GetString(Platform* platform, BNTokenEscapingType escaping) const { char* str = BNGetTypeString(m_object, platform ? platform->GetObject() : nullptr, escaping); @@ -1936,6 +1966,54 @@ TypeBuilder& TypeBuilder::SetParameters(const std::vector& pa } +std::set TypeBuilder::GetPointerSuffix() const +{ + size_t count = 0; + BNPointerSuffix* suffix = BNGetTypeBuilderPointerSuffix(m_object, &count); + std::set result(suffix, suffix + count); + BNFreePointerSuffixList(suffix, count); + return result; +} + + +std::string TypeBuilder::GetPointerSuffixString() const +{ + char* string = BNGetTypeBuilderPointerSuffixString(m_object); + std::string result(string); + BNFreeString(string); + return result; +} + + +std::vector TypeBuilder::GetPointerSuffixTokens(uint8_t baseConfidence) const +{ + size_t count = 0; + BNInstructionTextToken* tokens = BNGetTypeBuilderPointerSuffixTokens(m_object, baseConfidence, &count); + std::vector result = InstructionTextToken::ConvertInstructionTextTokenList(tokens, count); + BNFreeInstructionText(tokens, count); + return result; +} + + +TypeBuilder& TypeBuilder::AddPointerSuffix(BNPointerSuffix ps) +{ + BNAddTypeBuilderPointerSuffix(m_object, ps); + return *this; +} + + +TypeBuilder& TypeBuilder::SetPointerSuffix(const std::set& suffix) +{ + std::vector apiSuffix; + for (auto& s: suffix) + { + apiSuffix.push_back(s); + } + BNSetTypeBuilderPointerSuffix(m_object, apiSuffix.data(), apiSuffix.size()); + return *this; +} + + QualifiedName TypeBuilder::GetTypeName() const { BNQualifiedName name = BNTypeBuilderGetTypeName(m_object); -- cgit v1.3.1