From: fred Date: Sun, 22 Dec 1996 22:29:59 +0000 (+0000) Subject: flower-1.0.17 X-Git-Tag: release/1.5.59~6495 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d6964c99bce99ad6cb696f5ed0f3b05aadf7ea17;p=lilypond.git flower-1.0.17 --- diff --git a/flower/scalar.cc b/flower/scalar.cc index b53693928f..f981bc101f 100644 --- a/flower/scalar.cc +++ b/flower/scalar.cc @@ -1,6 +1,25 @@ #include #include "scalar.hh" +Scalar::Scalar(Rational r) + :String(r) +{ + +} + +Scalar::operator Rational() +{ + int p = pos('/'); + if (!p) + return int(*this); + + String s2 = right(len()-p); + p--; + String s1 = left(p); + + return Rational(s1.value(), s2.value()); +} + bool Scalar::isnum() { @@ -23,6 +42,7 @@ Scalar::operator int() assert (isnum()); return value(); } + bool Scalar::to_bool() const {