minor formatting
parent
e2b278e8bd
commit
98b5f6fa1e
|
@ -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)
|
||||||
|
|
|
@ -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], "%", "+");
|
||||||
|
|
|
@ -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());
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue