summaryrefslogtreecommitdiff
path: root/include/basegfx/polygon
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2013-10-15 11:27:23 +0300
committerTor Lillqvist <tml@collabora.com>2013-10-15 15:45:18 +0300
commit8a8d1e5b4961ada276a660b8b842f2f012a8ae85 (patch)
treebf6163b2886fae7bd8e2bd5c2391e2c9e051ab7a /include/basegfx/polygon
parent12947fd00d5192e7a448eb94faf0ab7b03f442c1 (diff)
Add operator<< to some classes for debugging output
Change-Id: I74a4c1217cc89e9d5da02a47ed45d6ce5fceb815
Diffstat (limited to 'include/basegfx/polygon')
-rw-r--r--include/basegfx/polygon/b2dpolygon.hxx21
-rw-r--r--include/basegfx/polygon/b2dpolypolygon.hxx24
2 files changed, 37 insertions, 8 deletions
diff --git a/include/basegfx/polygon/b2dpolygon.hxx b/include/basegfx/polygon/b2dpolygon.hxx
index 7c854fdc8a0e..712de7787d2c 100644
--- a/include/basegfx/polygon/b2dpolygon.hxx
+++ b/include/basegfx/polygon/b2dpolygon.hxx
@@ -20,13 +20,14 @@
#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
#define _BGFX_POLYGON_B2DPOLYGON_HXX
+#include <ostream>
+
#include <sal/types.h>
#include <o3tl/cow_wrapper.hxx>
#include <basegfx/vector/b2enums.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/basegfxdllapi.h>
-//////////////////////////////////////////////////////////////////////////////
// predeclarations
class ImplB2DPolygon;
@@ -39,8 +40,6 @@ namespace basegfx
class B2DCubicBezier;
} // end of namespace basegfx
-//////////////////////////////////////////////////////////////////////////////
-
namespace basegfx
{
class BASEGFX_DLLPUBLIC B2DPolygon
@@ -223,7 +222,21 @@ namespace basegfx
} // end of namespace basegfx
-//////////////////////////////////////////////////////////////////////////////
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const basegfx::B2DPolygon& poly )
+{
+ stream << "<" << poly.count() << ":";
+ for (sal_uInt32 i = 0; i < poly.count(); i++)
+ {
+ if (i > 0)
+ stream << "--";
+ stream << poly.getB2DPoint(i);
+ }
+ stream << ">";
+
+ return stream;
+}
#endif /* _BGFX_POLYGON_B2DPOLYGON_HXX */
diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx b/include/basegfx/polygon/b2dpolypolygon.hxx
index cd22644ab8ce..efe58337a886 100644
--- a/include/basegfx/polygon/b2dpolypolygon.hxx
+++ b/include/basegfx/polygon/b2dpolypolygon.hxx
@@ -20,23 +20,23 @@
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#define _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
+#include <ostream>
+#include <vector>
+
#include <sal/types.h>
#include <o3tl/cow_wrapper.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/basegfxdllapi.h>
-#include <vector>
+#include <basegfx/polygon/b2dpolygon.hxx>
// predeclarations
class ImplB2DPolyPolygon;
namespace basegfx
{
- class B2DPolygon;
class B2DHomMatrix;
} // end of namespace basegfx
-//////////////////////////////////////////////////////////////////////////////
-
namespace basegfx
{
class BASEGFX_DLLPUBLIC B2DPolyPolygon
@@ -132,6 +132,22 @@ namespace basegfx
} // end of namespace basegfx
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+ std::basic_ostream<charT, traits> & stream, const basegfx::B2DPolyPolygon& poly )
+{
+ stream << "[" << poly.count() << ":";
+ for (sal_uInt32 i = 0; i < poly.count(); i++)
+ {
+ if (i > 0)
+ stream << ",";
+ stream << poly.getB2DPolygon(i);
+ }
+ stream << "]";
+
+ return stream;
+}
+
#endif /* _BGFX_POLYGON_B2DPOLYPOLYGON_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */