MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / BuildTree

Method BuildTree

external/zep/src/mode_tree.cpp:25–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 }
24
25 void ZepMode_Tree::BuildTree() {
26 auto& buffer = m_window.GetBuffer();
27
28 std::ostringstream strBuffer;
29 std::function<void(ZepTreeNode*, uint32_t indent)> fnVisit;
30
31 fnVisit = [&](ZepTreeNode* pNode, uint32_t indent) {
32 for (uint32_t i = 0; i < indent; i++) {
33 strBuffer << " ";
34 }
35
36 if (pNode->HasChildren()) {
37 strBuffer << (pNode->IsExpanded() ? "~ " : "+ ");
38 } else {
39 strBuffer << " ";
40 }
41
42 strBuffer << pNode->GetName() << std::endl;
43
44 if (pNode->IsExpanded()) {
45 for (auto& pChild : pNode->GetChildren()) {
46 fnVisit(pChild.get(), indent + 2);
47 }
48 }
49 };
50
51 if (m_spTree->GetRoot()->IsExpanded()) {
52 for (auto pChild : m_spTree->GetRoot()->GetChildren()) {
53 fnVisit(pChild.get(), 0);
54 }
55 }
56
57 ChangeRecord tempRecord;
58 buffer.Clear();
59 buffer.Insert(buffer.Begin(), strBuffer.str(), tempRecord);
60 }
61
62 void ZepMode_Tree::Begin(ZepWindow* pWindow) {
63 ZepMode_Vim::Begin(pWindow);

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