docstring example for outputting attributes to stream

This commit is contained in:
ohsqueezy 2023-07-27 23:21:14 -04:00
parent 67c3e193f4
commit 67fa7e61c3
1 changed files with 13 additions and 0 deletions

View File

@ -249,6 +249,19 @@ void sb::Attributes::extend(const Attributes& other, std::size_t count)
}
}
/*!
* Add string representation of attributes to output stream, truncated to at most 8 vertices.
*
* sb::Attributes attr {{0, 0}, {5, 0}, {5, 5}, {0, 5}};
* std::cout << attr << std::endl;
* sb::Attributes attr2 {{0, 0}, {5, 0}, {5, 5}, {0, 5}, {0, 0}, {5, 0}, {5, 5}, {0, 5}};
* std::cout << attr2 << std::endl;
* sb::Attributes attr3 {{0, 0}, {5, 0}, {5, 5}, {0, 5}, {0, 0}, {5, 0}, {5, 5}, {0, 5}, {-5, -5}};
* std::cout << attr3 << std::endl;
* // <Attributes 2D, 32 bytes, { {0, 0} {5, 0} {5, 5} {0, 5} }>
* // <Attributes 2D, 64 bytes, { {0, 0} {5, 0} {5, 5} {0, 5} {0, 0} {5, 0} {5, 5} {0, 5} }>
* // <Attributes 2D, 72 bytes, { {0, 0} {5, 0} {5, 5} {0, 5} {0, 0} {5, 0} {5, 5} {0, 5} } + (1 more)>
*/
std::ostream& sb::operator<<(std::ostream& out, const sb::Attributes& attributes)
{
out << "<Attributes " << attributes.dimensions() << "D, " << attributes.size() << " bytes, ";