summaryrefslogtreecommitdiff
path: root/view/sharedcache/ui/SharedCacheBDNotifications.cpp
blob: f59f313c6d7f65c444cbc3e8c26de7d4afabd47d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Created by kat on 8/22/24.
//

#include "SharedCacheBDNotifications.h"


SharedCacheBDNotifications::SharedCacheBDNotifications(Ref<BinaryView> view)
	: BinaryDataNotification(FunctionUpdates | DataVariableUpdates)
{
}

void SharedCacheBDNotifications::OnAnalysisFunctionAdded(BinaryView* view, Function* func)
{
	//
	// We just cannot do this until one of:
	// "Component::AddAutoFunction"
	// BinaryView::BeginIgnoredUndoActions
	// some similar fix

	/*
	if (view->GetTypeName() == VIEW_NAME)
	{
		auto sections = view->GetSectionsAt(func->GetStart());
		if (sections.size() > 0)
		{
			auto section = sections[0];
			auto imageName = section->GetName().substr(0, section->GetName().find("::"));
			auto id = view->BeginUndoActions();
			auto comp = view->GetComponentByPath(imageName);
			if (!comp)
			{
				comp = view->CreateComponentWithName(imageName);
			}
			comp.value()->AddFunction(func);
			view->ForgetUndoActions(id);
		}
	}
	 */
}


void SharedCacheBDNotifications::OnSectionAdded(BinaryView* data, Section* section)
{

}


void SharedCacheBDNotifications::OnDataVariableAdded(BinaryView* view, const DataVariable& var)
{
	/*
	if (view->GetTypeName() == VIEW_NAME)
	{
		auto sections = view->GetSectionsAt(var.address);
		if (sections.size() > 0)
		{
			auto section = sections[0];
			auto imageName = section->GetName().substr(0, section->GetName().find("::"));
			auto comp = view->GetComponentByPath(imageName);
			auto id = view->BeginUndoActions();
			if (!comp)
			{
				comp = view->CreateComponentWithName(imageName);
			}
			comp.value()->AddDataVariable(var);
			view->ForgetUndoActions(id);
		}
	}*/
}