summaryrefslogtreecommitdiff
path: root/include/vcl/region.hxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-02-02 22:25:28 +0100
committerMichael Stahl <mstahl@redhat.com>2014-02-03 12:34:06 +0100
commite4be770ec8218d80dcc9f1e38fd1c69717beb4fb (patch)
tree54906d6850d9263b21b82845cbe5bfaac3460335 /include/vcl/region.hxx
parent9b9eb2e4f619c63eabdc54b5d749ac55d8eaf333 (diff)
add std::ostream operators for Region and PolyPolygon
Change-Id: I8f4129b840a27f3029643ad2a4852f9e10604905
Diffstat (limited to 'include/vcl/region.hxx')
-rw-r--r--include/vcl/region.hxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/vcl/region.hxx b/include/vcl/region.hxx
index d3eec642c8aa..3a3a64b78dcd 100644
--- a/include/vcl/region.hxx
+++ b/include/vcl/region.hxx
@@ -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: */