X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Finclude%2Fscalar.hh;h=a963a2fb2a4a620af96ac17bf576841b79efadec;hb=1cf3d59c1559fb9774c4c1c8cae155cfe54a927c;hp=e8c58e684e06f106930f219865f8b9c492a4c52e;hpb=1e95a0be01466d1c98644f7705c8e07e41cc645c;p=lilypond.git diff --git a/flower/include/scalar.hh b/flower/include/scalar.hh index e8c58e684e..a963a2fb2a 100644 --- a/flower/include/scalar.hh +++ b/flower/include/scalar.hh @@ -3,7 +3,7 @@ source file of the Flower Library - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ @@ -12,15 +12,16 @@ #include "string.hh" #include "real.hh" +#include "matrix.hh" /// Perl -like scalar type. -struct Scalar : public String { - - Scalar (Real r) : String (r) {} - Scalar (int i) : String (i) {} - Scalar (char c) : String (c) {} +struct Scalar : public String +{ + Scalar (Real r) { *this = to_str (r); } + Scalar (int i) { *this = to_str (i); } + Scalar (char c) { *this = to_str (c); } Scalar (char const *c) : String (c) {} - Scalar (String s):String (s) {} + Scalar (String s) : String (s) {} Scalar (Rational); operator Rational(); Scalar() {} @@ -29,6 +30,13 @@ struct Scalar : public String { operator int(); bool to_bool () const; + /* + urg, these are bit silly; perhaps should make "Print_string" class + (derive from Scalar?) + */ + Scalar (Vector v) { *this = v.str (); } + Scalar (Matrix m) { *this = m.str (); } + /** perl -like string to bool conversion. */ operator bool() const;