LibreOffice Module tools (master) 1
|
#include <fract.hxx>
Public Member Functions | |
Fraction ()=default | |
Fraction (const Fraction &rFrac)=default | |
Fraction (Fraction &&rFrac)=default | |
Fraction (double dVal) | |
Fraction (double nNum, double nDen) | |
only here to prevent passing of NaN More... | |
Fraction (sal_Int64 nNum, sal_Int64 nDen) | |
template<typename T1 , typename T2 > | |
Fraction (T1 nNum, T2 nDen, typename std::enable_if< std::is_integral< T1 >::value &&std::is_integral< T2 >::value, int >::type=0) | |
bool | IsValid () const |
sal_Int32 | GetNumerator () const |
sal_Int32 | GetDenominator () const |
operator sal_Int32 () const | |
operator double () const | |
Fraction & | operator= (const Fraction &rfrFrac)=default |
Fraction & | operator= (Fraction &&rfrFrac)=default |
Fraction & | operator= (double v) |
Fraction & | operator+= (const Fraction &rfrFrac) |
Fraction & | operator-= (const Fraction &rfrFrac) |
Fraction & | operator*= (const Fraction &rfrFrac) |
Fraction & | operator/= (const Fraction &rfrFrac) |
Fraction & | operator+= (double v) |
Fraction & | operator-= (double v) |
Fraction & | operator*= (double v) |
Fraction & | operator/= (double v) |
void | ReduceInaccurate (unsigned nSignificantBits) |
size_t | GetHashValue () const |
Static Public Member Functions | |
static Fraction | MakeFraction (tools::Long nN1, tools::Long nN2, tools::Long nD1, tools::Long nD2) |
Multiply the two fractions represented here and reduce inaccuracy to 32-bits, used by vcl. More... | |
Private Attributes | |
sal_Int32 | mnNumerator = 0 |
these two fields form a boost::rational, but I didn't want to put more boost headers into the global space More... | |
sal_Int32 | mnDenominator = 1 |
bool | mbValid = true |
Friends | |
TOOLS_DLLPUBLIC friend Fraction | operator+ (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend Fraction | operator- (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend Fraction | operator* (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend Fraction | operator/ (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend bool | operator== (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend bool | operator!= (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend bool | operator< (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend bool | operator> (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend bool | operator<= (const Fraction &rVal1, const Fraction &rVal2) |
TOOLS_DLLPUBLIC friend bool | operator>= (const Fraction &rVal1, const Fraction &rVal2) |
|
default |
Referenced by MakeFraction().
|
default |
|
default |
|
explicit |
Definition at line 100 of file fract.cxx.
References mbValid, mnDenominator, mnNumerator, rational_FromDouble(), SAL_WARN, and v.
Fraction::Fraction | ( | double | nNum, |
double | nDen | ||
) |
Fraction::Fraction | ( | sal_Int64 | nNum, |
sal_Int64 | nDen | ||
) |
Definition at line 58 of file fract.cxx.
References isOutOfRange(), mbValid, mnDenominator, mnNumerator, and SAL_WARN_IF.
sal_Int32 Fraction::GetDenominator | ( | ) | const |
Definition at line 292 of file fract.cxx.
References mbValid, mnDenominator, and SAL_WARN.
Referenced by tools::GenericTypeSerializer::writeFraction().
size_t Fraction::GetHashValue | ( | ) | const |
Definition at line 481 of file fract.cxx.
References o3tl::hash_combine(), mbValid, mnDenominator, and mnNumerator.
sal_Int32 Fraction::GetNumerator | ( | ) | const |
Definition at line 282 of file fract.cxx.
References mbValid, mnNumerator, and SAL_WARN.
Referenced by tools::GenericTypeSerializer::writeFraction().
|
inline |
Definition at line 49 of file fract.hxx.
References mbValid.
Referenced by tools::GenericTypeSerializer::writeFraction().
|
static |
Multiply the two fractions represented here and reduce inaccuracy to 32-bits, used by vcl.
Definition at line 490 of file fract.cxx.
References a, Fraction(), i, SAL_WARN, and toRational().
|
explicit |
Definition at line 115 of file fract.cxx.
References mbValid, SAL_WARN, and toRational().
|
explicit |
Definition at line 302 of file fract.cxx.
References mbValid, SAL_WARN, and toRational().
Definition at line 203 of file fract.cxx.
References a, mbValid, mnDenominator, mnNumerator, SAL_WARN, and toRational().
|
inline |
Definition at line 70 of file fract.hxx.
References operator*=(), and v.
Referenced by operator*=().
Definition at line 130 of file fract.cxx.
References a, mbValid, mnDenominator, mnNumerator, SAL_WARN, and toRational().
|
inline |
Definition at line 68 of file fract.hxx.
References operator+=(), and v.
Referenced by operator+=().
Definition at line 149 of file fract.cxx.
References a, mbValid, mnDenominator, mnNumerator, SAL_WARN, and toRational().
|
inline |
Definition at line 69 of file fract.hxx.
References operator-=(), and v.
Referenced by operator-=().
Definition at line 228 of file fract.cxx.
References a, mbValid, mnDenominator, mnNumerator, SAL_WARN, and toRational().
|
inline |
Definition at line 71 of file fract.hxx.
References operator/=(), and v.
Referenced by operator/=().
|
inline |
void Fraction::ReduceInaccurate | ( | unsigned | nSignificantBits | ) |
Definition at line 265 of file fract.cxx.
References a, mbValid, mnDenominator, mnNumerator, rational_ReduceInaccurate(), SAL_WARN, and toRational().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
Definition at line 35 of file fract.hxx.
Referenced by Fraction(), GetDenominator(), GetHashValue(), GetNumerator(), operator*=(), operator+=(), operator-=(), operator/=(), and ReduceInaccurate().
|
private |
Definition at line 34 of file fract.hxx.
Referenced by Fraction(), GetDenominator(), GetHashValue(), operator*=(), operator+=(), operator-=(), operator/=(), and ReduceInaccurate().
|
private |
these two fields form a boost::rational, but I didn't want to put more boost headers into the global space
Definition at line 33 of file fract.hxx.
Referenced by Fraction(), GetHashValue(), GetNumerator(), operator*=(), operator+=(), operator-=(), operator/=(), and ReduceInaccurate().