diff options
| author | Glenn Smith <glenn@vector35.com> | 2024-05-10 20:01:13 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2024-05-23 18:12:07 -0400 |
| commit | 0824604746724984472975400443871294158813 (patch) | |
| tree | 7eed161fcfd448af057db0144150310c8edfc37b /type.cpp | |
| parent | 3375478963786425457931027834955525009658 (diff) | |
Expose Type::PointerSuffix
Diffstat (limited to 'type.cpp')
| -rw-r--r-- | type.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
@@ -693,6 +693,36 @@ Confidence<int64_t> Type::GetStackAdjustment() const } +std::set<BNPointerSuffix> Type::GetPointerSuffix() const +{ + size_t count = 0; + BNPointerSuffix* suffix = BNGetTypePointerSuffix(m_object, &count); + std::set<BNPointerSuffix> 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<InstructionTextToken> Type::GetPointerSuffixTokens(uint8_t baseConfidence) const +{ + size_t count = 0; + BNInstructionTextToken* tokens = BNGetTypePointerSuffixTokens(m_object, baseConfidence, &count); + std::vector<InstructionTextToken> 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<FunctionParameter>& pa } +std::set<BNPointerSuffix> TypeBuilder::GetPointerSuffix() const +{ + size_t count = 0; + BNPointerSuffix* suffix = BNGetTypeBuilderPointerSuffix(m_object, &count); + std::set<BNPointerSuffix> 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<InstructionTextToken> TypeBuilder::GetPointerSuffixTokens(uint8_t baseConfidence) const +{ + size_t count = 0; + BNInstructionTextToken* tokens = BNGetTypeBuilderPointerSuffixTokens(m_object, baseConfidence, &count); + std::vector<InstructionTextToken> 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<BNPointerSuffix>& suffix) +{ + std::vector<BNPointerSuffix> 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); |
