]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/offset.hh
* flower/include/std-string.hh: String/std::string compatibility:
[lilypond.git] / flower / include / offset.hh
index 8ea8c8581523329b7d4bb36ea751cd4d8f667bda..5ca7e0e68c637130c2c9fe7e42b8d90503b97d77 100644 (file)
@@ -1,15 +1,18 @@
 /*
   offset.hh -- part of GNU LilyPond
 
-  (c) 1996--2005 Han-Wen Nienhuys
+  (c) 1996--2006 Han-Wen Nienhuys
 */
 
 #ifndef OFFSET_HH
 #define OFFSET_HH
 
-#include "axes.hh"
+#include "axis.hh"
+#include "std-string.hh"
 #include "string.hh"
+#include "real.hh"
 
+class Offset;
 Offset complex_multiply (Offset, Offset);
 Offset complex_divide (Offset, Offset);
 Offset complex_exp (Offset);
@@ -66,6 +69,12 @@ public:
     return *this;
   }
 
+  Offset &operator /= (Real a)
+  {
+    (*this) *= 1/a;
+    return *this;
+  }
+
   Offset &operator *= (Real a)
   {
     (*this)[X_AXIS] *= a;
@@ -85,7 +94,7 @@ public:
     coordinate_a_[X_AXIS] = coordinate_a_[Y_AXIS] = 0.0;
   }
 
-  String to_string () const;
+  Std_string to_string () const;
 
   Offset &mirror (Axis a)
   {
@@ -95,7 +104,7 @@ public:
 
   Real arg () const;
   Real length () const;
-
+  bool is_sane () const;
   Offset operator *= (Offset z2)
   {
     *this = complex_multiply (*this, z2);
@@ -114,6 +123,13 @@ operator * (Real o1, Offset o2)
   return o2;
 }
 
+inline Offset
+operator / (Offset o1, Real a)
+{
+  o1 /= a;
+  return o1;
+}
+
 inline Offset
 operator * (Offset o1, Real o2)
 {