summaryrefslogtreecommitdiff
path: root/binaryview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'binaryview.cpp')
-rw-r--r--binaryview.cpp30
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);