diff options
| author | Rusty Wagner <rusty@vector35.com> | 2018-07-11 20:32:22 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2018-07-11 20:32:22 -0400 |
| commit | dfe5d28f0aaee75ccad8c733e23879676ed77c37 (patch) | |
| tree | b4b15cd48d5126e5e7a097b049fbf9aad2fca475 /flowgraph.cpp | |
| parent | bfa6fce83383e7be1458a917f8e6dbf71bdab28b (diff) | |
Add APIs for subclassing flow graphs
Diffstat (limited to 'flowgraph.cpp')
| -rw-r--r-- | flowgraph.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/flowgraph.cpp b/flowgraph.cpp index e557f540..4bacee81 100644 --- a/flowgraph.cpp +++ b/flowgraph.cpp @@ -24,6 +24,17 @@ using namespace BinaryNinja; using namespace std; +FlowGraph::FlowGraph() +{ + BNCustomFlowGraph callbacks; + callbacks.context = this; + callbacks.prepareForLayout = PrepareForLayoutCallback; + callbacks.populateNodes = PopulateNodesCallback; + callbacks.completeLayout = CompleteLayoutCallback; + m_graph = BNCreateCustomFlowGraph(&callbacks); +} + + FlowGraph::FlowGraph(BNFlowGraph* graph): m_graph(graph) { } @@ -46,6 +57,49 @@ void FlowGraph::CompleteCallback(void* ctxt) } +void FlowGraph::PrepareForLayoutCallback(void* ctxt) +{ + FlowGraph* graph = (FlowGraph*)ctxt; + graph->PrepareForLayout(); +} + + +void FlowGraph::PopulateNodesCallback(void* ctxt) +{ + FlowGraph* graph = (FlowGraph*)ctxt; + graph->PopulateNodes(); +} + + +void FlowGraph::CompleteLayoutCallback(void* ctxt) +{ + FlowGraph* graph = (FlowGraph*)ctxt; + graph->CompleteLayout(); +} + + +void FlowGraph::FinishPrepareForLayout() +{ + BNFinishPrepareForLayout(m_graph); +} + + +void FlowGraph::PrepareForLayout() +{ + FinishPrepareForLayout(); +} + + +void FlowGraph::PopulateNodes() +{ +} + + +void FlowGraph::CompleteLayout() +{ +} + + Ref<Function> FlowGraph::GetFunction() const { BNFunction* func = BNGetFunctionForFlowGraph(m_graph); |
