diff options
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/generic/fract.cxx | 10 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index 49c26c0f1be4..7f2ffba1003d 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -19,6 +19,7 @@ #include <tools/fract.hxx> #include <tools/debug.hxx> +#include <o3tl/hash_combine.hxx> #include <o3tl/safeint.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> @@ -473,4 +474,13 @@ static void rational_ReduceInaccurate(boost::rational<sal_Int32>& rRational, uns rRational.assign( bNeg ? -nMul : nMul, nDiv ); } +size_t Fraction::GetHashValue() const +{ + size_t hash = 0; + o3tl::hash_combine( hash, mnNumerator ); + o3tl::hash_combine( hash, mnDenominator ); + o3tl::hash_combine( hash, mbValid ); + return hash; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index b3331b7b4e4d..27120d6abbd1 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -22,6 +22,7 @@ #include <algorithm> #include <tuple> +#include <o3tl/hash_combine.hxx> #include <o3tl/safeint.hxx> #include <tools/gen.hxx> @@ -33,6 +34,14 @@ OString Pair::toString() const return OString::number(A()) + ", " + OString::number(B()); } +size_t Pair::GetHashValue() const +{ + size_t hash = 0; + o3tl::hash_combine( hash, nA ); + o3tl::hash_combine( hash, nB ); + return hash; +} + void tools::Rectangle::SetSize( const Size& rSize ) { if ( rSize.Width() < 0 ) |