MuseScore  3.4
Music composition and notation
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Ms::Fraction Class Reference

#include <fraction.h>

Inheritance diagram for Ms::Fraction:
Inheritance graph
[legend]

Public Member Functions

constexpr Fraction ()
 
constexpr Fraction (int z, int n)
 
int numerator () const
 
int denominator () const
 
int_least64_t & rnumerator ()
 
int_least64_t & rdenominator ()
 
void setNumerator (int v)
 
void setDenominator (int v)
 
void set (int z, int n)
 
bool isZero () const
 
bool isNotZero () const
 
bool isValid () const
 
bool identical (const Fraction &v) const
 
Fraction absValue () const
 
void reduce ()
 
Fraction reduced () const
 
bool operator< (const Fraction &val) const
 
bool operator<= (const Fraction &val) const
 
bool operator>= (const Fraction &val) const
 
bool operator> (const Fraction &val) const
 
bool operator== (const Fraction &val) const
 
bool operator!= (const Fraction &val) const
 
Fractionoperator+= (const Fraction &val)
 
Fractionoperator-= (const Fraction &val)
 
Fractionoperator*= (const Fraction &val)
 
Fractionoperator*= (int val)
 
Fractionoperator/= (const Fraction &val)
 
Fraction operator+ (const Fraction &v) const
 
Fraction operator- (const Fraction &v) const
 
Fraction operator- () const
 
Fraction operator* (const Fraction &v) const
 
Fraction operator/ (const Fraction &v) const
 
int ticks () const
 
QString print () const
 
QString toString () const
 
 operator QVariant () const
 

Static Public Member Functions

static Fraction fromTicks (int ticks)
 
static Fraction eps ()
 A very small fraction, corresponds to 1 MIDI tick. More...
 
static Fraction fromString (const QString &str)
 

Private Attributes

int_least64_t _numerator { 0 }
 
int_least64_t _denominator { 1 }
 

Constructor & Destructor Documentation

◆ Fraction() [1/2]

constexpr Ms::Fraction::Fraction ( )
inline

◆ Fraction() [2/2]

constexpr Ms::Fraction::Fraction ( int  z,
int  n 
)
inline

Member Function Documentation

◆ absValue()

Fraction Ms::Fraction::absValue ( ) const
inline

◆ denominator()

int Ms::Fraction::denominator ( ) const
inline

◆ eps()

static Fraction Ms::Fraction::eps ( )
inlinestatic

A very small fraction, corresponds to 1 MIDI tick.

◆ fromString()

static Fraction Ms::Fraction::fromString ( const QString &  str)
inlinestatic

◆ fromTicks()

static Fraction Ms::Fraction::fromTicks ( int  ticks)
inlinestatic

◆ identical()

bool Ms::Fraction::identical ( const Fraction v) const
inline

◆ isNotZero()

bool Ms::Fraction::isNotZero ( ) const
inline

◆ isValid()

bool Ms::Fraction::isValid ( ) const
inline

◆ isZero()

bool Ms::Fraction::isZero ( ) const
inline

◆ numerator()

int Ms::Fraction::numerator ( ) const
inline

◆ operator QVariant()

Ms::Fraction::operator QVariant ( ) const
inline

◆ operator!=()

bool Ms::Fraction::operator!= ( const Fraction val) const
inline

◆ operator*()

Fraction Ms::Fraction::operator* ( const Fraction v) const
inline

◆ operator*=() [1/2]

Fraction& Ms::Fraction::operator*= ( const Fraction val)
inline

◆ operator*=() [2/2]

Fraction& Ms::Fraction::operator*= ( int  val)
inline

◆ operator+()

Fraction Ms::Fraction::operator+ ( const Fraction v) const
inline

◆ operator+=()

Fraction& Ms::Fraction::operator+= ( const Fraction val)
inline

◆ operator-() [1/2]

Fraction Ms::Fraction::operator- ( const Fraction v) const
inline

◆ operator-() [2/2]

Fraction Ms::Fraction::operator- ( ) const
inline

◆ operator-=()

Fraction& Ms::Fraction::operator-= ( const Fraction val)
inline

◆ operator/()

Fraction Ms::Fraction::operator/ ( const Fraction v) const
inline

◆ operator/=()

Fraction& Ms::Fraction::operator/= ( const Fraction val)
inline

◆ operator<()

bool Ms::Fraction::operator< ( const Fraction val) const
inline

◆ operator<=()

bool Ms::Fraction::operator<= ( const Fraction val) const
inline

◆ operator==()

bool Ms::Fraction::operator== ( const Fraction val) const
inline

◆ operator>()

bool Ms::Fraction::operator> ( const Fraction val) const
inline

◆ operator>=()

bool Ms::Fraction::operator>= ( const Fraction val) const
inline

◆ print()

QString Ms::Fraction::print ( ) const
inline

◆ rdenominator()

int_least64_t& Ms::Fraction::rdenominator ( )
inline

◆ reduce()

void Ms::Fraction::reduce ( )
inline

◆ reduced()

Fraction Ms::Fraction::reduced ( ) const
inline

◆ rnumerator()

int_least64_t& Ms::Fraction::rnumerator ( )
inline

◆ set()

void Ms::Fraction::set ( int  z,
int  n 
)
inline

◆ setDenominator()

void Ms::Fraction::setDenominator ( int  v)
inline

◆ setNumerator()

void Ms::Fraction::setNumerator ( int  v)
inline

◆ ticks()

int Ms::Fraction::ticks ( ) const
inline

◆ toString()

QString Ms::Fraction::toString ( ) const
inline

Member Data Documentation

◆ _denominator

int_least64_t Ms::Fraction::_denominator { 1 }
private

◆ _numerator

int_least64_t Ms::Fraction::_numerator { 0 }
private

The documentation for this class was generated from the following file: