add std::ostream operators for Region and PolyPolygon
Change-Id: I8f4129b840a27f3029643ad2a4852f9e10604905
This commit is contained in:
@@ -278,6 +278,18 @@ public:
|
||||
|
||||
typedef std::vector< PolyPolygon > PolyPolyVector;
|
||||
|
||||
|
||||
template<typename charT, typename traits>
|
||||
inline std::basic_ostream<charT, traits> & operator <<(
|
||||
std::basic_ostream<charT, traits> & stream, const PolyPolygon& rPolyPoly)
|
||||
{
|
||||
if (!rPolyPoly.Count())
|
||||
stream << "EMPTY";
|
||||
for (sal_uInt16 i = 0; i < rPolyPoly.Count(); ++i)
|
||||
stream << "[" << i << "] " << rPolyPoly.GetObject(i);
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -126,6 +126,35 @@ public:
|
||||
static Region GetRegionFromPolyPolygon( const PolyPolygon& rPolyPoly );
|
||||
};
|
||||
|
||||
|
||||
template< typename charT, typename traits >
|
||||
inline std::basic_ostream<charT, traits> & operator <<(
|
||||
std::basic_ostream<charT, traits> & stream, const Region& rRegion)
|
||||
{
|
||||
if (rRegion.IsEmpty())
|
||||
return stream << "EMPTY";
|
||||
if (rRegion.getB2DPolyPolygon())
|
||||
return stream << "B2DPolyPolygon("
|
||||
<< *rRegion.getB2DPolyPolygon()
|
||||
<< ")";
|
||||
if (rRegion.getPolyPolygon())
|
||||
return stream << "PolyPolygon("
|
||||
<< *rRegion.getPolyPolygon()
|
||||
<< ")";
|
||||
if (rRegion.getRegionBand())
|
||||
{ // inlined because RegionBand is private to vcl
|
||||
stream << "RegionBand(";
|
||||
RectangleVector rects;
|
||||
rRegion.GetRegionRectangles(rects);
|
||||
if (rects.empty())
|
||||
stream << "EMPTY";
|
||||
for (size_t i = 0; i < rects.size(); ++i)
|
||||
stream << "[" << i << "] " << rects[i];
|
||||
stream << ")";
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
#endif // INCLUDED_VCL_REGION_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user