mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
Strip redundant newline in repr() for taxonomy items
E.g. print([m.diffuse for m in shape.geometry.materials]) would print [colour 0.7 0.7 0.7 ] Instead of: [colour 0.7 0.7 0.7]
This commit is contained in:
@@ -151,7 +151,14 @@ std::pair<char const*, size_t> vector_to_buffer(const T& t) {
|
|||||||
std::string taxonomy_item_repr(ifcopenshell::geometry::taxonomy::item::ptr i) {
|
std::string taxonomy_item_repr(ifcopenshell::geometry::taxonomy::item::ptr i) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
i->print(oss);
|
i->print(oss);
|
||||||
return oss.str();
|
std::string result = oss.str();
|
||||||
|
|
||||||
|
// Strip new line at the end of the printed result.
|
||||||
|
// result is probably always ends with \n but just to be safe.
|
||||||
|
if (!result.empty() && result.back() == '\n') {
|
||||||
|
result.pop_back();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user