summaryrefslogtreecommitdiff
path: root/component.cpp
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2023-01-03 14:29:32 -0500
committerkat <kat@vector35.com>2023-02-20 13:23:31 -0500
commitfcfa33a14fc309984880b535b9f9b4fcfc316466 (patch)
tree0d2b1c62e9939d357a508a446f440541709625e4 /component.cpp
parent982d90f20e400c7fe7b254eee31fe7eca4e11c2c (diff)
Allow DataVariables to be added to Components
Diffstat (limited to 'component.cpp')
-rw-r--r--component.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/component.cpp b/component.cpp
index 88e7a20a..03be498a 100644
--- a/component.cpp
+++ b/component.cpp
@@ -71,6 +71,12 @@ bool Component::AddComponent(Ref<Component> component)
}
+bool Component::AddDataVariable(DataVariable dataVariable)
+{
+ return BNComponentAddDataVariable(m_object, dataVariable.address);
+}
+
+
bool Component::RemoveComponent(Ref<Component> component)
{
return BNComponentRemoveComponent(component->m_object);
@@ -83,6 +89,12 @@ bool Component::RemoveFunction(Ref<Function> func)
}
+bool Component::RemoveDataVariable(DataVariable dataVariable)
+{
+ return BNComponentRemoveDataVariable(m_object, dataVariable.address);
+}
+
+
std::vector<Ref<Component>> Component::GetContainedComponents()
{
std::vector<Ref<Component>> components;
@@ -123,6 +135,27 @@ std::vector<Ref<Function>> Component::GetContainedFunctions()
}
+std::vector<DataVariable> Component::GetContainedDataVariables()
+{
+ vector<DataVariable> result;
+
+ size_t count;
+ BNDataVariable* variables = BNComponentGetContainedDataVariables(m_object, &count);
+
+ result.reserve(count);
+ for (size_t i = 0; i < count; ++i)
+ {
+ result.emplace_back(variables[i].address,
+ Confidence(new Type(BNNewTypeReference(variables[i].type)), variables[i].typeConfidence),
+ variables[i].autoDiscovered);
+ }
+
+ BNFreeDataVariables(variables, count);
+ return result;
+}
+
+
+
std::vector<Ref<Type>> Component::GetReferencedTypes()
{
std::vector<Ref<Type>> types;