Kaydet (Commit) 8a8d1e5b authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Add operator<< to some classes for debugging output

Change-Id: I74a4c1217cc89e9d5da02a47ed45d6ce5fceb815
üst 12947fd0
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
#ifndef _BGFX_POINT_B2DPOINT_HXX #ifndef _BGFX_POINT_B2DPOINT_HXX
#define _BGFX_POINT_B2DPOINT_HXX #define _BGFX_POINT_B2DPOINT_HXX
#include <ostream>
#include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/tuple/b2dtuple.hxx>
#include <basegfx/point/b2ipoint.hxx> #include <basegfx/point/b2ipoint.hxx>
#include <basegfx/basegfxdllapi.h> #include <basegfx/basegfxdllapi.h>
//////////////////////////////////////////////////////////////////////////////
namespace basegfx namespace basegfx
{ {
// predeclaration // predeclaration
...@@ -129,7 +129,6 @@ namespace basegfx ...@@ -129,7 +129,6 @@ namespace basegfx
}; };
// external operators // external operators
//////////////////////////////////////////////////////////////////////////
/** Transform B2DPoint by given transformation matrix. /** Transform B2DPoint by given transformation matrix.
...@@ -139,7 +138,12 @@ namespace basegfx ...@@ -139,7 +138,12 @@ namespace basegfx
BASEGFX_DLLPUBLIC B2DPoint operator*( const B2DHomMatrix& rMat, const B2DPoint& rPoint ); BASEGFX_DLLPUBLIC B2DPoint operator*( const B2DHomMatrix& rMat, const B2DPoint& rPoint );
} // end of 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::B2DPoint& point )
{
return stream << "(" << point.getX() << "," << point.getY() << ")";
}
#endif /* _BGFX_POINT_B2DPOINT_HXX */ #endif /* _BGFX_POINT_B2DPOINT_HXX */
......
...@@ -20,13 +20,14 @@ ...@@ -20,13 +20,14 @@
#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX #ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
#define _BGFX_POLYGON_B2DPOLYGON_HXX #define _BGFX_POLYGON_B2DPOLYGON_HXX
#include <ostream>
#include <sal/types.h> #include <sal/types.h>
#include <o3tl/cow_wrapper.hxx> #include <o3tl/cow_wrapper.hxx>
#include <basegfx/vector/b2enums.hxx> #include <basegfx/vector/b2enums.hxx>
#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drange.hxx>
#include <basegfx/basegfxdllapi.h> #include <basegfx/basegfxdllapi.h>
//////////////////////////////////////////////////////////////////////////////
// predeclarations // predeclarations
class ImplB2DPolygon; class ImplB2DPolygon;
...@@ -39,8 +40,6 @@ namespace basegfx ...@@ -39,8 +40,6 @@ namespace basegfx
class B2DCubicBezier; class B2DCubicBezier;
} // end of namespace basegfx } // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
namespace basegfx namespace basegfx
{ {
class BASEGFX_DLLPUBLIC B2DPolygon class BASEGFX_DLLPUBLIC B2DPolygon
...@@ -223,7 +222,21 @@ namespace basegfx ...@@ -223,7 +222,21 @@ namespace basegfx
} // end of 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 */ #endif /* _BGFX_POLYGON_B2DPOLYGON_HXX */
......
...@@ -20,23 +20,23 @@ ...@@ -20,23 +20,23 @@
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX #ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#define _BGFX_POLYGON_B2DPOLYPOLYGON_HXX #define _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#include <ostream>
#include <vector>
#include <sal/types.h> #include <sal/types.h>
#include <o3tl/cow_wrapper.hxx> #include <o3tl/cow_wrapper.hxx>
#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drange.hxx>
#include <basegfx/basegfxdllapi.h> #include <basegfx/basegfxdllapi.h>
#include <vector> #include <basegfx/polygon/b2dpolygon.hxx>
// predeclarations // predeclarations
class ImplB2DPolyPolygon; class ImplB2DPolyPolygon;
namespace basegfx namespace basegfx
{ {
class B2DPolygon;
class B2DHomMatrix; class B2DHomMatrix;
} // end of namespace basegfx } // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
namespace basegfx namespace basegfx
{ {
class BASEGFX_DLLPUBLIC B2DPolyPolygon class BASEGFX_DLLPUBLIC B2DPolyPolygon
...@@ -132,6 +132,22 @@ namespace basegfx ...@@ -132,6 +132,22 @@ namespace basegfx
} // end of 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 */ #endif /* _BGFX_POLYGON_B2DPOLYPOLYGON_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -20,14 +20,15 @@ ...@@ -20,14 +20,15 @@
#ifndef _BGFX_RANGE_B2DRANGE_HXX #ifndef _BGFX_RANGE_B2DRANGE_HXX
#define _BGFX_RANGE_B2DRANGE_HXX #define _BGFX_RANGE_B2DRANGE_HXX
#include <ostream>
#include <vector>
#include <basegfx/vector/b2dvector.hxx> #include <basegfx/vector/b2dvector.hxx>
#include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2dpoint.hxx>
#include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/tuple/b2dtuple.hxx>
#include <basegfx/range/basicrange.hxx> #include <basegfx/range/basicrange.hxx>
#include <vector>
#include <basegfx/basegfxdllapi.h> #include <basegfx/basegfxdllapi.h>
namespace basegfx namespace basegfx
{ {
// predeclarations // predeclarations
...@@ -315,6 +316,13 @@ namespace basegfx ...@@ -315,6 +316,13 @@ namespace basegfx
} // end of 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::B2DRange& range )
{
return stream << range.getWidth() << "x" << range.getHeight() << "@" << range.getMinimum();
}
#endif /* _BGFX_RANGE_B2DRANGE_HXX */ #endif /* _BGFX_RANGE_B2DRANGE_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -20,15 +20,16 @@ ...@@ -20,15 +20,16 @@
#ifndef _BGFX_RANGE_B2IBOX_HXX #ifndef _BGFX_RANGE_B2IBOX_HXX
#define _BGFX_RANGE_B2IBOX_HXX #define _BGFX_RANGE_B2IBOX_HXX
#include <ostream>
#include <vector>
#include <basegfx/point/b2ipoint.hxx> #include <basegfx/point/b2ipoint.hxx>
#include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2dpoint.hxx>
#include <basegfx/tuple/b2ituple.hxx> #include <basegfx/tuple/b2ituple.hxx>
#include <basegfx/tuple/b2i64tuple.hxx> #include <basegfx/tuple/b2i64tuple.hxx>
#include <basegfx/range/basicbox.hxx> #include <basegfx/range/basicbox.hxx>
#include <vector>
#include <basegfx/basegfxdllapi.h> #include <basegfx/basegfxdllapi.h>
namespace basegfx namespace basegfx
{ {
/** A two-dimensional interval over integers /** A two-dimensional interval over integers
...@@ -256,6 +257,17 @@ namespace basegfx ...@@ -256,6 +257,17 @@ namespace basegfx
} // end of 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::B2IBox& box )
{
if (box.isEmpty())
return stream << "EMPTY";
else
return stream << box.getWidth() << 'x' << box.getHeight()
<< "@(" << box.getMinX() << "," << box.getMinY() << ")";
}
#endif /* _BGFX_RANGE_B2IBOX_HXX */ #endif /* _BGFX_RANGE_B2IBOX_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -20,15 +20,16 @@ ...@@ -20,15 +20,16 @@
#ifndef _BGFX_RANGE_B2IRANGE_HXX #ifndef _BGFX_RANGE_B2IRANGE_HXX
#define _BGFX_RANGE_B2IRANGE_HXX #define _BGFX_RANGE_B2IRANGE_HXX
#include <ostream>
#include <vector>
#include <basegfx/point/b2ipoint.hxx> #include <basegfx/point/b2ipoint.hxx>
#include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2dpoint.hxx>
#include <basegfx/tuple/b2ituple.hxx> #include <basegfx/tuple/b2ituple.hxx>
#include <basegfx/tuple/b2i64tuple.hxx> #include <basegfx/tuple/b2i64tuple.hxx>
#include <basegfx/range/basicrange.hxx> #include <basegfx/range/basicrange.hxx>
#include <vector>
#include <basegfx/basegfxdllapi.h> #include <basegfx/basegfxdllapi.h>
namespace basegfx namespace basegfx
{ {
/** A two-dimensional interval over integers /** A two-dimensional interval over integers
...@@ -282,6 +283,17 @@ namespace basegfx ...@@ -282,6 +283,17 @@ namespace basegfx
} // end of 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::B2IRange& range )
{
if (range.isEmpty())
return stream << "EMPTY";
else
return stream << range.getWidth() << 'x' << range.getHeight()
<< "@(" << range.getMinX() << "," << range.getMinY() << ")";
}
#endif /* _BGFX_RANGE_B2IRANGE_HXX */ #endif /* _BGFX_RANGE_B2IRANGE_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#ifndef _BGFX_VECTOR_B2IVECTOR_HXX #ifndef _BGFX_VECTOR_B2IVECTOR_HXX
#define _BGFX_VECTOR_B2IVECTOR_HXX #define _BGFX_VECTOR_B2IVECTOR_HXX
#include <ostream>
#include <basegfx/tuple/b2ituple.hxx> #include <basegfx/tuple/b2ituple.hxx>
#include <basegfx/vector/b2enums.hxx> #include <basegfx/vector/b2enums.hxx>
#include <basegfx/basegfxdllapi.h> #include <basegfx/basegfxdllapi.h>
...@@ -130,7 +132,6 @@ namespace basegfx ...@@ -130,7 +132,6 @@ namespace basegfx
}; };
// external operators // external operators
//////////////////////////////////////////////////////////////////////////
/** Transform vector by given transformation matrix. /** Transform vector by given transformation matrix.
...@@ -141,6 +142,13 @@ namespace basegfx ...@@ -141,6 +142,13 @@ namespace basegfx
} // end of 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::B2IVector& vector )
{
return stream << "(" << vector.getX() << "," << vector.getY() << ")";
}
#endif /* _BGFX_VECTOR_B2IVECTOR_HXX */ #endif /* _BGFX_VECTOR_B2IVECTOR_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment