| 34 | } |
| 35 | |
| 36 | void 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 | |
| 82 | void ZepMode_Tree::Begin(ZepWindow* pWindow) |
| 83 | { |
nothing calls this directly
no test coverage detected