MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / mount

Method mount

modules/gui/gui/src/framework/layer/layer.cpp:8–44  ·  view source on GitHub ↗

lifecycle & tree ctor -> mount <-> unmount -> destroy

Source from the content-addressed store, hash-verified

6// lifecycle & tree
7// ctor -> mount <-> unmount -> destroy
8void Layer::mount(NotNull<Layer*> parent) SKR_NOEXCEPT
9{
10 // validate
11 if (_parent != nullptr)
12 {
13 unmount();
14 SKR_GUI_LOG_ERROR(u8"already mounted");
15 }
16 {
17 Layer* node = parent;
18 while (node->_parent)
19 {
20 node = node->_parent;
21 if (node == this)
22 {
23 SKR_GUI_LOG_ERROR(u8"cycle in the tree");
24 break;
25 }
26 }
27 }
28
29 // mount
30 _parent = parent;
31 if (parent->owner())
32 {
33 struct _RecursiveHelper {
34 NotNull<BuildOwner*> owner;
35
36 void operator()(NotNull<Layer*> obj) const SKR_NOEXCEPT
37 {
38 obj->attach(owner);
39 obj->visit_children(_RecursiveHelper{ owner });
40 }
41 };
42 _RecursiveHelper{ parent->owner() }(this);
43 }
44}
45void Layer::unmount() SKR_NOEXCEPT
46{
47 // validate

Callers 12

mainFunction · 0.45
mainFunction · 0.45
add_childMethod · 0.45
set_childMethod · 0.45
add_childMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
initializeFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
main.cppFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected