ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

A simple rational class that holds fractions. More...

#include <rational.h>

List of all members.

Public Member Functions

 Rational ()
 Rational (int num)
 Rational (int num, int denom)
Rationaloperator= (const Rational &right)
Rationaloperator= (int right)
Rationaloperator+= (const Rational &right)
Rationaloperator-= (const Rational &right)
Rationaloperator*= (const Rational &right)
Rationaloperator/= (const Rational &right)
Rationaloperator+= (int right)
Rationaloperator-= (int right)
Rationaloperator*= (int right)
Rationaloperator/= (int right)
const Rational operator- () const
const Rational operator+ (const Rational &right) const
const Rational operator- (const Rational &right) const
const Rational operator* (const Rational &right) const
const Rational operator/ (const Rational &right) const
const Rational operator+ (int right) const
const Rational operator- (int right) const
const Rational operator* (int right) const
const Rational operator/ (int right) const
bool operator== (const Rational &right) const
bool operator!= (const Rational &right) const
bool operator> (const Rational &right) const
bool operator< (const Rational &right) const
bool operator>= (const Rational &right) const
bool operator<= (const Rational &right) const
bool operator== (int right) const
bool operator!= (int right) const
bool operator> (int right) const
bool operator< (int right) const
bool operator>= (int right) const
bool operator<= (int right) const
void invert ()
Rational getInverse () const
int toInt () const
double toDouble () const
frac_t toFrac () const
int getNumerator () const
int getDenominator () const
bool isOne () const
void debugPrint (int debuglevel=0, const char *caption="Rational:") const

Private Member Functions

void cancel ()

Private Attributes

int _num
int _denom

Detailed Description

A simple rational class that holds fractions.

Definition at line 32 of file rational.h.


Constructor & Destructor Documentation

Common::Rational::Rational (  ) 

Definition at line 30 of file rational.cpp.

Common::Rational::Rational ( int  num  ) 

Definition at line 35 of file rational.cpp.

Common::Rational::Rational ( int  num,
int  denom 
)

Definition at line 40 of file rational.cpp.


Member Function Documentation

void Common::Rational::cancel (  )  [private]

Definition at line 54 of file rational.cpp.

void Common::Rational::debugPrint ( int  debuglevel = 0,
const char *  caption = "Rational:" 
) const

Definition at line 295 of file rational.cpp.

int Common::Rational::getDenominator (  )  const [inline]

Definition at line 85 of file rational.h.

Rational Common::Rational::getInverse (  )  const

Definition at line 251 of file rational.cpp.

int Common::Rational::getNumerator (  )  const [inline]

Definition at line 84 of file rational.h.

void Common::Rational::invert (  ) 

Definition at line 240 of file rational.cpp.

bool Common::Rational::isOne (  )  const [inline]

Definition at line 87 of file rational.h.

bool Common::Rational::operator!= ( const Rational right  )  const

Definition at line 196 of file rational.cpp.

bool Common::Rational::operator!= ( int  right  )  const

Definition at line 220 of file rational.cpp.

const Rational Common::Rational::operator* ( const Rational right  )  const

Definition at line 156 of file rational.cpp.

const Rational Common::Rational::operator* ( int  right  )  const

Definition at line 180 of file rational.cpp.

Rational & Common::Rational::operator*= ( int  right  ) 

Definition at line 132 of file rational.cpp.

Rational & Common::Rational::operator*= ( const Rational right  ) 

Definition at line 108 of file rational.cpp.

const Rational Common::Rational::operator+ ( int  right  )  const

Definition at line 168 of file rational.cpp.

const Rational Common::Rational::operator+ ( const Rational right  )  const

Definition at line 144 of file rational.cpp.

Rational & Common::Rational::operator+= ( const Rational right  ) 

Definition at line 78 of file rational.cpp.

Rational & Common::Rational::operator+= ( int  right  ) 

Definition at line 124 of file rational.cpp.

const Rational Common::Rational::operator- ( int  right  )  const

Definition at line 174 of file rational.cpp.

const Rational Common::Rational::operator- (  )  const

Definition at line 140 of file rational.cpp.

const Rational Common::Rational::operator- ( const Rational right  )  const

Definition at line 150 of file rational.cpp.

Rational & Common::Rational::operator-= ( int  right  ) 

Definition at line 128 of file rational.cpp.

Rational & Common::Rational::operator-= ( const Rational right  ) 

Definition at line 93 of file rational.cpp.

const Rational Common::Rational::operator/ ( int  right  )  const

Definition at line 186 of file rational.cpp.

const Rational Common::Rational::operator/ ( const Rational right  )  const

Definition at line 162 of file rational.cpp.

Rational & Common::Rational::operator/= ( int  right  ) 

Definition at line 136 of file rational.cpp.

Rational & Common::Rational::operator/= ( const Rational right  ) 

Definition at line 120 of file rational.cpp.

bool Common::Rational::operator< ( int  right  )  const

Definition at line 228 of file rational.cpp.

bool Common::Rational::operator< ( const Rational right  )  const

Definition at line 204 of file rational.cpp.

bool Common::Rational::operator<= ( int  right  )  const

Definition at line 236 of file rational.cpp.

bool Common::Rational::operator<= ( const Rational right  )  const

Definition at line 212 of file rational.cpp.

Rational & Common::Rational::operator= ( int  right  ) 

Definition at line 71 of file rational.cpp.

Rational & Common::Rational::operator= ( const Rational right  ) 

Definition at line 64 of file rational.cpp.

bool Common::Rational::operator== ( const Rational right  )  const

Definition at line 192 of file rational.cpp.

bool Common::Rational::operator== ( int  right  )  const

Definition at line 216 of file rational.cpp.

bool Common::Rational::operator> ( const Rational right  )  const

Definition at line 200 of file rational.cpp.

bool Common::Rational::operator> ( int  right  )  const

Definition at line 224 of file rational.cpp.

bool Common::Rational::operator>= ( int  right  )  const

Definition at line 232 of file rational.cpp.

bool Common::Rational::operator>= ( const Rational right  )  const

Definition at line 208 of file rational.cpp.

double Common::Rational::toDouble (  )  const

Definition at line 263 of file rational.cpp.

frac_t Common::Rational::toFrac (  )  const

Definition at line 267 of file rational.cpp.

int Common::Rational::toInt (  )  const

Definition at line 259 of file rational.cpp.


Member Data Documentation

int Common::Rational::_denom [private]

Definition at line 93 of file rational.h.

int Common::Rational::_num [private]

Definition at line 92 of file rational.h.


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


Generated on Sat Sep 14 2019 05:04:06 for ResidualVM by doxygen 1.7.1
curved edge   curved edge