MCPcopy Create free account
hub / github.com/Rezonality/zep / BuildTree

Method BuildTree

src/mode_tree.cpp:36–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void ZepMode_Tree::BuildTree()
37{
38 auto& buffer = m_window.GetBuffer();
39
40 std::ostringstream strBuffer;
41 std::function<void(ZepTreeNode*, uint32_t indent)> fnVisit;
42
43 fnVisit = [&](ZepTreeNode* pNode, uint32_t indent) {
44 for (uint32_t i = 0; i < indent; i++)
45 {
46 strBuffer << " ";
47 }
48
49 if (pNode->HasChildren())
50 {
51 strBuffer << (pNode->IsExpanded() ? "~ " : "+ ");
52 }
53 else
54 {
55 strBuffer << " ";
56 }
57
58 strBuffer << pNode->GetName() << std::endl;
59
60 if (pNode->IsExpanded())
61 {
62 for (auto& pChild : pNode->GetChildren())
63 {
64 fnVisit(pChild.get(), indent + 2);
65 }
66 }
67 };
68
69 if (m_spTree->GetRoot()->IsExpanded())
70 {
71 for (auto pChild : m_spTree->GetRoot()->GetChildren())
72 {
73 fnVisit(pChild.get(), 0);
74 }
75 }
76
77 ChangeRecord tempRecord;
78 buffer.Clear();
79 buffer.Insert(buffer.Begin(), strBuffer.str(), tempRecord);
80}
81
82void ZepMode_Tree::Begin(ZepWindow* pWindow)
83{

Callers

nothing calls this directly

Calls 10

HasChildrenMethod · 0.80
IsExpandedMethod · 0.80
GetNameMethod · 0.80
GetChildrenMethod · 0.80
GetRootMethod · 0.80
strMethod · 0.80
getMethod · 0.45
ClearMethod · 0.45
InsertMethod · 0.45
BeginMethod · 0.45

Tested by

no test coverage detected