Kaydet (Commit) 3b1dcf2e authored tarafından Luboš Luňák's avatar Luboš Luňák

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
üst ea91c7d9
...@@ -190,6 +190,13 @@ inline Point operator/( const Point &rVal1, const long nVal2 ) ...@@ -190,6 +190,13 @@ inline Point operator/( const Point &rVal1, const long nVal2 )
return Point( rVal1.nA/nVal2, rVal1.nB/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 // Size
class SAL_WARN_UNUSED Size : public Pair class SAL_WARN_UNUSED Size : public Pair
...@@ -219,6 +226,13 @@ inline Size::Size( long nWidth, long nHeight ) : ...@@ -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 // Range
#define RANGE_MAX LONG_MAX #define RANGE_MAX LONG_MAX
...@@ -264,6 +278,13 @@ inline void Range::Justify() ...@@ -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 // Selection
#define SELECTION_MIN LONG_MIN #define SELECTION_MIN LONG_MIN
...@@ -323,6 +344,12 @@ inline void Selection::Justify() ...@@ -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 // Rectangle
#define RECT_EMPTY ((short)-32767) #define RECT_EMPTY ((short)-32767)
...@@ -647,6 +674,14 @@ inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ) ...@@ -647,6 +674,14 @@ inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt )
return aRect; 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 #endif
/* 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