diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-10-26 12:50:28 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-10-26 23:17:44 +0200 |
commit | ac07b5150dfed20ca2e401e49b6cc78eae64b1e7 (patch) | |
tree | 53434e82ae277f78d18e4f5202b8206ce9b68301 /include/tools | |
parent | 230d05ea289668441dfac4faeea75dd0213ab6f7 (diff) |
tools: print some Fractions
Change-Id: Idc4668cba7412d0b4a3e486a8629c7f95a701091
Diffstat (limited to 'include/tools')
-rw-r--r-- | include/tools/fract.hxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx index 74075e63cafc..bba143b0530d 100644 --- a/include/tools/fract.hxx +++ b/include/tools/fract.hxx @@ -22,6 +22,7 @@ #include <sal/types.h> #include <tools/toolsdllapi.h> #include <memory> +#include <ostream> #include <type_traits> class SvStream; @@ -106,6 +107,14 @@ inline Fraction operator-( const Fraction& rVal1, double v2 ) { return rVal1 - F inline Fraction operator*( const Fraction& rVal1, double v2 ) { return rVal1 * Fraction(v2); } inline Fraction operator/( const Fraction& rVal1, double v2 ) { return rVal1 / Fraction(v2); } +template<typename charT, typename traits> +inline std::basic_ostream<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & rStream, const Fraction& rFraction) +{ + rStream << "(" << rFraction.GetNumerator() << "/" << rFraction.GetDenominator() << ")"; + return rStream; +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |