From 98b5f6fa1e62d716710dba41c37eb91cf1faeed1 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Thu, 30 Nov 2023 20:14:18 -0500 Subject: [PATCH] minor formatting --- include/blt/std/string.h | 1 - src/blt/std/format.cpp | 4 +--- tests/src/utility_test.cpp | 5 ++--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/include/blt/std/string.h b/include/blt/std/string.h index cff152a..7df7eb9 100755 --- a/include/blt/std/string.h +++ b/include/blt/std/string.h @@ -271,7 +271,6 @@ namespace blt::string } } - // taken from https://stackoverflow.com/questions/216823/how-to-trim-an-stdstring // would've preferred to use boost lib but instructions said to avoid external libs // trim from start (in place) diff --git a/src/blt/std/format.cpp b/src/blt/std/format.cpp index 3fa3333..5b454f1 100755 --- a/src/blt/std/format.cpp +++ b/src/blt/std/format.cpp @@ -277,7 +277,6 @@ std::vector blt::string::TreeFormatter::construct() char type = lines[index][p]; for (size_t n = 0; n < verticalSpacing / 2; n++) lines[index + n + 1][p] = '|'; - lines[index + (verticalSpacing / 2) + 1][p] = '+'; auto start = index + (verticalSpacing / 2) + 1; switch (type) { @@ -297,7 +296,6 @@ std::vector blt::string::TreeFormatter::construct() for (size_t i = poses2[consume] + 1; i < p; i++) lines[start][i] = '-'; lines[start][poses2[consume]] = '+'; - lines[start][p] = '+'; for (size_t n = 0; n < verticalSpacing / 2; n++) lines[start + n + 1][poses2[consume]] = '|'; consume++; @@ -306,7 +304,6 @@ std::vector blt::string::TreeFormatter::construct() for (size_t i = p; i < poses2[consume]; i++) lines[start][i] = '-'; lines[start][poses2[consume]] = '+'; - lines[start][p] = '+'; for (size_t n = 0; n < verticalSpacing / 2; n++) lines[start + n + 1][poses2[consume]] = '|'; consume++; @@ -314,6 +311,7 @@ std::vector blt::string::TreeFormatter::construct() default: break; } + lines[start][p] = '+'; } } blt::string::replaceAll(lines[index], "%", "+"); diff --git a/tests/src/utility_test.cpp b/tests/src/utility_test.cpp index 29f1ffa..8ecae8e 100644 --- a/tests/src/utility_test.cpp +++ b/tests/src/utility_test.cpp @@ -62,10 +62,9 @@ void blt::test::utility::run() blt::string::TreeFormatter treeFormatter("I love Men"); treeFormatter.getRoot()->with( - (new string::TreeFormatter::Node("Guys")) - ->with(new string::TreeFormatter::Node("Child1"), nullptr), + (new string::TreeFormatter::Node("Guys"))->with(nullptr, new string::TreeFormatter::Node("Child2")), (new string::TreeFormatter::Node("Femboys")) - ->with(nullptr, new string::TreeFormatter::Node("Child2"))); + ->with(nullptr, new string::TreeFormatter::Node("Child1"))); printLines(treeFormatter.construct());