summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-11-21 17:52:00 +0100
committerLuboš Luňák <l.lunak@suse.cz>2012-11-21 17:57:20 +0100
commit3b1dcf2e35af2e5ec3405572a709876d0cfa63eb (patch)
tree18e2f79bd5134b3466c9294b478df91c003d7fd3 /tools
parentea91c7d90d74e1ca039ba669b5d3e14fa359c0fa (diff)
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
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/tools/gen.hxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx
index 6c93e2b36926..acbf75a0983f 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: */