diff options
| author | Glenn Smith <glenn@vector35.com> | 2023-03-15 20:51:48 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2023-03-29 20:34:14 -0400 |
| commit | 7977801957364139464406602038722124434273 (patch) | |
| tree | 6ddcaba6992061f10932688a0dddafb8020953d4 /binaryview.cpp | |
| parent | 3911076326059945990138870942693848884934 (diff) | |
BinaryView::LookupImportedType*
Diffstat (limited to 'binaryview.cpp')
| -rw-r--r-- | binaryview.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/binaryview.cpp b/binaryview.cpp index eeef5a74..67fe011c 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -3731,6 +3731,21 @@ void BinaryView::RegisterPlatformTypes(Platform* platform) } +std::optional<std::pair<Ref<Platform>, QualifiedName>> BinaryView::LookupImportedTypePlatform(const QualifiedName& name) +{ + BNPlatform* resultLib; + BNQualifiedName resultName; + BNQualifiedName sourceName = name.GetAPIObject(); + bool result = BNLookupImportedTypePlatform(m_object, &sourceName, &resultLib, &resultName); + QualifiedName::FreeAPIObject(&sourceName); + if (!result) + return std::nullopt; + QualifiedName targetName = QualifiedName::FromAPIObject(&resultName); + BNFreeQualifiedName(&resultName); + return std::make_pair(new Platform(resultLib), targetName); +} + + void BinaryView::AddTypeLibrary(TypeLibrary* lib) { BNAddBinaryViewTypeLibrary(m_object, lib->GetObject()); @@ -3824,6 +3839,21 @@ std::optional<std::pair<Ref<TypeLibrary>, QualifiedName>> BinaryView::LookupImpo } +std::optional<std::pair<Ref<TypeLibrary>, QualifiedName>> BinaryView::LookupImportedTypeLibrary(const QualifiedName& name) +{ + BNTypeLibrary* resultLib; + BNQualifiedName resultName; + BNQualifiedName sourceName = name.GetAPIObject(); + bool result = BNBinaryViewLookupImportedTypeLibrary(m_object, &sourceName, &resultLib, &resultName); + QualifiedName::FreeAPIObject(&sourceName); + if (!result) + return std::nullopt; + QualifiedName targetName = QualifiedName::FromAPIObject(&resultName); + BNFreeQualifiedName(&resultName); + return std::make_pair(new TypeLibrary(resultLib), targetName); +} + + bool BinaryView::FindNextData(uint64_t start, const DataBuffer& data, uint64_t& result, BNFindFlag flags) { return BNFindNextData(m_object, start, data.GetBufferObject(), &result, flags); |
