]> git.donarmstrong.com Git - lilypond.git/commitdiff
flower-1.0.17
authorfred <fred>
Sun, 22 Dec 1996 22:29:59 +0000 (22:29 +0000)
committerfred <fred>
Sun, 22 Dec 1996 22:29:59 +0000 (22:29 +0000)
flower/scalar.cc

index b53693928fc613d6326ce202e4ee2b7e20a6a336..f981bc101f83a5b5f01f4fbc3cb44eb8fea52dfc 100644 (file)
@@ -1,6 +1,25 @@
 #include <stdio.h>
 #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
 {