summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2018-07-11 20:32:22 -0400
committerRusty Wagner <rusty@vector35.com>2018-07-11 20:32:22 -0400
commitdfe5d28f0aaee75ccad8c733e23879676ed77c37 (patch)
treeb4b15cd48d5126e5e7a097b049fbf9aad2fca475 /binaryninjaapi.h
parentbfa6fce83383e7be1458a917f8e6dbf71bdab28b (diff)
Add APIs for subclassing flow graphs
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h38
1 files changed, 32 insertions, 6 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 3582b265..1133625e 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -54,6 +54,7 @@ namespace BinaryNinja
virtual ~RefCountObject() {}
RefCountObject* GetObject() { return this; }
+ static RefCountObject* GetObject(RefCountObject* obj) { return obj; }
void AddRef()
{
@@ -107,6 +108,13 @@ namespace BinaryNinja
T* GetObject() const { return m_object; }
+ static T* GetObject(CoreRefCountObject* obj)
+ {
+ if (!obj)
+ return nullptr;
+ return obj->GetObject();
+ }
+
void AddRef()
{
if (m_object && (m_refs != 0))
@@ -164,6 +172,13 @@ namespace BinaryNinja
T* GetObject() const { return m_object; }
+ static T* GetObject(StaticCoreRefCountObject* obj)
+ {
+ if (!obj)
+ return nullptr;
+ return obj->GetObject();
+ }
+
void AddRef()
{
AddRefInternal();
@@ -252,32 +267,32 @@ namespace BinaryNinja
bool operator==(const T* obj) const
{
- return m_obj->GetObject() == obj->GetObject();
+ return T::GetObject(m_obj) == T::GetObject(obj);
}
bool operator==(const Ref<T>& obj) const
{
- return m_obj->GetObject() == obj.m_obj->GetObject();
+ return T::GetObject(m_obj) == T::GetObject(obj.m_obj);
}
bool operator!=(const T* obj) const
{
- return m_obj->GetObject() != obj->GetObject();
+ return T::GetObject(m_obj) != T::GetObject(obj);
}
bool operator!=(const Ref<T>& obj) const
{
- return m_obj->GetObject() != obj.m_obj->GetObject();
+ return T::GetObject(m_obj) != T::GetObject(obj.m_obj);
}
bool operator<(const T* obj) const
{
- return m_obj->GetObject() < obj->GetObject();
+ return T::GetObject(m_obj) < T::GetObject(obj);
}
bool operator<(const Ref<T>& obj) const
{
- return m_obj->GetObject() < obj.m_obj->GetObject();
+ return T::GetObject(m_obj) < T::GetObject(obj.m_obj);
}
T* GetPtr() const
@@ -2567,7 +2582,18 @@ namespace BinaryNinja
static void CompleteCallback(void* ctxt);
+ static void PrepareForLayoutCallback(void* ctxt);
+ static void PopulateNodesCallback(void* ctxt);
+ static void CompleteLayoutCallback(void* ctxt);
+
+ protected:
+ void FinishPrepareForLayout();
+ virtual void PrepareForLayout();
+ virtual void PopulateNodes();
+ virtual void CompleteLayout();
+
public:
+ FlowGraph();
FlowGraph(BNFlowGraph* graph);
~FlowGraph();