minor formatting

v1
Brett 2023-11-30 20:14:18 -05:00
parent e2b278e8bd
commit 98b5f6fa1e
3 changed files with 3 additions and 7 deletions

View File

@ -271,7 +271,6 @@ namespace blt::string
} }
} }
// taken from https://stackoverflow.com/questions/216823/how-to-trim-an-stdstring // 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 // would've preferred to use boost lib but instructions said to avoid external libs
// trim from start (in place) // trim from start (in place)

View File

@ -277,7 +277,6 @@ std::vector<std::string> blt::string::TreeFormatter::construct()
char type = lines[index][p]; char type = lines[index][p];
for (size_t n = 0; n < verticalSpacing / 2; n++) for (size_t n = 0; n < verticalSpacing / 2; n++)
lines[index + n + 1][p] = '|'; lines[index + n + 1][p] = '|';
lines[index + (verticalSpacing / 2) + 1][p] = '+';
auto start = index + (verticalSpacing / 2) + 1; auto start = index + (verticalSpacing / 2) + 1;
switch (type) switch (type)
{ {
@ -297,7 +296,6 @@ std::vector<std::string> blt::string::TreeFormatter::construct()
for (size_t i = poses2[consume] + 1; i < p; i++) for (size_t i = poses2[consume] + 1; i < p; i++)
lines[start][i] = '-'; lines[start][i] = '-';
lines[start][poses2[consume]] = '+'; lines[start][poses2[consume]] = '+';
lines[start][p] = '+';
for (size_t n = 0; n < verticalSpacing / 2; n++) for (size_t n = 0; n < verticalSpacing / 2; n++)
lines[start + n + 1][poses2[consume]] = '|'; lines[start + n + 1][poses2[consume]] = '|';
consume++; consume++;
@ -306,7 +304,6 @@ std::vector<std::string> blt::string::TreeFormatter::construct()
for (size_t i = p; i < poses2[consume]; i++) for (size_t i = p; i < poses2[consume]; i++)
lines[start][i] = '-'; lines[start][i] = '-';
lines[start][poses2[consume]] = '+'; lines[start][poses2[consume]] = '+';
lines[start][p] = '+';
for (size_t n = 0; n < verticalSpacing / 2; n++) for (size_t n = 0; n < verticalSpacing / 2; n++)
lines[start + n + 1][poses2[consume]] = '|'; lines[start + n + 1][poses2[consume]] = '|';
consume++; consume++;
@ -314,6 +311,7 @@ std::vector<std::string> blt::string::TreeFormatter::construct()
default: default:
break; break;
} }
lines[start][p] = '+';
} }
} }
blt::string::replaceAll(lines[index], "%", "+"); blt::string::replaceAll(lines[index], "%", "+");

View File

@ -62,10 +62,9 @@ void blt::test::utility::run()
blt::string::TreeFormatter treeFormatter("I love Men"); blt::string::TreeFormatter treeFormatter("I love Men");
treeFormatter.getRoot()->with( treeFormatter.getRoot()->with(
(new string::TreeFormatter::Node("Guys")) (new string::TreeFormatter::Node("Guys"))->with(nullptr, new string::TreeFormatter::Node("Child2")),
->with(new string::TreeFormatter::Node("Child1"), nullptr),
(new string::TreeFormatter::Node("Femboys")) (new string::TreeFormatter::Node("Femboys"))
->with(nullptr, new string::TreeFormatter::Node("Child2"))); ->with(nullptr, new string::TreeFormatter::Node("Child1")));
printLines(treeFormatter.construct()); printLines(treeFormatter.construct());