Brought across Region operator<< from Cubiquity branch.

This commit is contained in:
David Williams 2013-06-22 10:16:16 +02:00
parent 5664e2f681
commit 288b448b9f
2 changed files with 18 additions and 1 deletions

View File

@ -202,6 +202,10 @@ namespace PolyVox
int32_t m_iUpperZ;
};
// Non-member overloaded operators.
/// Stream insertion operator.
std::ostream& operator<<(std::ostream& os, const Region& region);
// Functions to be inlined to to be in the header rather than the .cpp.
// 'inline' keyword is used for the definition rather than the declaration.
// See also http://www.parashift.com/c++-faq-lite/inline-functions.html

View File

@ -487,4 +487,17 @@ namespace PolyVox
{
shrink(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ());
}
}
/**
* Enables the Region to be used intuitively with output streams such as cout.
* \param os The output stream to write to.
* \param region The Region to write to the stream.
* \return A reference to the output stream to allow chaining.
*/
std::ostream& operator<<(std::ostream& os, const Region& region)
{
os << "(" << region.getLowerX() << "," << region.getLowerY() << "," << region.getLowerZ() <<
") to (" << region.getUpperX() << "," << region.getUpperY() << "," << region.getUpperZ() << ")";
return os;
}
}