 |
Verovio
Source code documentation
|
8 #ifndef __VRV_FRACTION_H__
9 #define __VRV_FRACTION_H__
23 explicit Fraction(
int num = 0) : m_numerator(num), m_denominator(1) {}
24 explicit Fraction(
int num,
int denom);
25 explicit Fraction(data_DURATION duration);
28 template <
typename T,
typename = std::enable_if_t<std::is_same_v<T,
int>>>
29 Fraction(T num) : m_numerator(num), m_denominator(1)
47 std::strong_ordering operator<=>(
const Fraction &other)
const;
51 int GetDenominator()
const {
return m_denominator; }
60 std::pair<data_DURATION, Fraction>
ToDur()
const;
67 static void Reduce(
int &numerator,
int &denominator);
std::pair< data_DURATION, Fraction > ToDur() const
Convert to data_DURATION and the remaining Fraction.
double ToDouble() const
Convert fraction to a double.
Fraction operator-(const Fraction &other) const
Subtraction operator.
Definition: fraction.h:19
int GetNumerator() const
Getters.
Definition: fraction.h:50
Fraction operator%(const Fraction &other) const
Modulo operator.
bool operator==(const Fraction &other) const
Equality operator.
std::string ToString() const
Convert fraction to a string.
Fraction operator+(const Fraction &other) const
Addition operator.
Fraction operator/(const Fraction &other) const
Division operator.
Fraction operator*(const Fraction &other) const
Multiplication operator.