tools/inc/tools/gen.hxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
New commits: commit 3b1dcf2e35af2e5ec3405572a709876d0cfa63eb Author: LuboÅ¡ LuÅák <[email protected]> Date: Wed Nov 21 17:52:00 2012 +0100 debug helpers for Point, Size, Rect, etc. I'm kinda tired of typing it out (what kind of imbecile lumps all these classes together into one header and still can't decide whether accessors are Foo() or getFoo() and the capitalization of that?). Change-Id: I15b69280265ae8570378f9f905cca66d546a252c diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx index 6c93e2b..acbf75a 100644 --- a/tools/inc/tools/gen.hxx +++ b/tools/inc/tools/gen.hxx @@ -190,6 +190,13 @@ inline Point operator/( const Point &rVal1, const long nVal2 ) return Point( rVal1.nA/nVal2, rVal1.nB/nVal2 ); } +template< typename charT, typename traits > +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, const Point& point ) +{ + return stream << point.X() << ',' << point.Y(); +} + // Size class SAL_WARN_UNUSED Size : public Pair @@ -219,6 +226,13 @@ inline Size::Size( long nWidth, long nHeight ) : { } +template< typename charT, typename traits > +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, const Size& size ) +{ + return stream << size.Width() << 'x' << size.Height(); +} + // Range #define RANGE_MAX LONG_MAX @@ -264,6 +278,13 @@ inline void Range::Justify() } } +template< typename charT, typename traits > +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, const Range& range ) +{ + return stream << range.Min() << '-' << range.Max(); +} + // Selection #define SELECTION_MIN LONG_MIN @@ -323,6 +344,12 @@ inline void Selection::Justify() } } +template< typename charT, typename traits > +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, const Selection& selection ) +{ + return stream << selection.Min() << '-' << selection.Max(); +} // Rectangle #define RECT_EMPTY ((short)-32767) @@ -647,6 +674,14 @@ inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ) return aRect; } +template< typename charT, typename traits > +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & stream, const Rectangle& rectangle ) +{ + return stream << rectangle.getX() << ',' << rectangle.getY() << ' ' + << rectangle.getWidth() << 'x' << rectangle.getHeight(); +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
