]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4503 (1/4) Clean up Tie::less and Semi_Tie::less
authorDan Eble <nine.fierce.ballads@gmail.com>
Sat, 11 Jul 2015 19:53:17 +0000 (15:53 -0400)
committerDan Eble <nine.fierce.ballads@gmail.com>
Tue, 21 Jul 2015 18:09:46 +0000 (14:09 -0400)
lily/include/semi-tie.hh
lily/include/tie.hh
lily/semi-tie.cc
lily/tie.cc

index 6eb6472e712c439bdf97a41a07f906feb9f38fff..8c52dc64d6516284df0bcbd2dd04e262dc1ee827 100644 (file)
@@ -29,8 +29,7 @@ struct Semi_tie
 
   DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM));
-  static bool less (Grob *const &s1,
-                    Grob *const &s2);
+  static bool less (Grob *s1, Grob *s2);
   static int get_column_rank (Item *);
   static int get_position (Item *);
   static Item *head (Item *);
index 7b74d159c85d046913685f41746ccd194dcb4441..a6b3bf59a7d19804b3e80789c246f11e4b2d7305 100644 (file)
@@ -42,8 +42,7 @@ public:
   DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_control_points, (SCM));
-  static bool less (Grob *const &s1,
-                    Grob *const &s2);
+  static bool less (Grob *s1, Grob *s2);
 };
 
 #endif // TIE_HH
index 1cc82c3b08839a397198010384524114d801345d..193008751433dcaf3f7a5f7d6827a0bec6e88669 100644 (file)
@@ -84,10 +84,16 @@ Semi_tie::get_position (Item *me)
 }
 
 bool
-Semi_tie::less (Grob *const &s1,
-                Grob *const &s2)
+Semi_tie::less (Grob *g1, Grob *g2)
 {
-  return Tie::get_position_generic (s1) < Tie::get_position_generic (s2);
+  Item *i1 = dynamic_cast<Item *> (g1);
+  Item *i2 = dynamic_cast<Item *> (g2);
+  if (i1 && i2) {
+    return get_position (i1) < get_position (i2);
+  }
+
+  programming_error ("grob is not a semi-tie");
+  return false;
 }
 
 Item *
index 47c5a1c9cfb9809b1d58b6f0186a069dff9bcc9d..72855687e362dff78ea66e864813b9bd0421d457 100644 (file)
 #include "semi-tie-column.hh"
 
 bool
-Tie::less (Grob *const &s1, Grob *const &s2)
+Tie::less (Grob *g1, Grob *g2)
 {
-  return get_position_generic (s1) < get_position_generic (s2);
+  Spanner *s1 = dynamic_cast<Spanner *> (g1);
+  Spanner *s2 = dynamic_cast<Spanner *> (g2);
+  if (s1 && s2) {
+    return get_position (s1) < get_position (s2);
+  }
+
+  programming_error ("grob is not a tie");
+  return false;
 }
 
 void