]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/musical-request.cc
release: 1.1.1
[lilypond.git] / lily / musical-request.cc
index b1d5120fe8f1d61395bec47b111bcfc5ec9f86ec..c12cd16c29ab476e27dd9c02a4c5f93daf8aa701 100644 (file)
@@ -22,12 +22,17 @@ void
 Tie_req::do_print () const{}
 
 
-/* *************** */
 
+IMPLEMENT_IS_TYPE_B1(Span_req,Request);
 
+IMPLEMENT_IS_TYPE_B2(Musical_span_req, Span_req, Musical_span_req);
 
-
-IMPLEMENT_IS_TYPE_B1 (Span_req,Musical_req);
+void
+Musical_span_req::do_print () const
+{
+  Span_req::do_print ();
+}
+            
 
 void
 Span_req::do_print () const
@@ -77,7 +82,6 @@ Blank_req::do_print () const
 {
   Spacing_req::do_print ();
 }
-/* *************** */
 
 Melodic_req::Melodic_req ()
 {
@@ -100,8 +104,8 @@ IMPLEMENT_IS_TYPE_B1 (Melodic_req,Musical_req);
 bool
 Melodic_req::do_equal_b (Request*r) const
 {
-  Melodic_req* m= r->access_Musical_req ()->access_Melodic_req ();
-  return !compare (*m, *this);
+  Melodic_req* m= dynamic_cast <Melodic_req *> (r);
+  return m&& !compare (*m, *this);
 }
 
 int
@@ -116,7 +120,6 @@ Melodic_req::do_print () const
 pitch_.print ();
 }
 
-/* *************** */
 int
 Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2)
 {
@@ -126,16 +129,11 @@ Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2)
 bool
 Rhythmic_req::do_equal_b (Request*r) const
 {
-  Rhythmic_req* rh = r->access_Musical_req ()->access_Rhythmic_req ();
+  Rhythmic_req* rh = dynamic_cast <Rhythmic_req *> (r);
 
-  return !compare (*this, *rh);
+  return rh&& !compare (*this, *rh);
 }
 
-void
-Rhythmic_req::set_duration (Duration d)
-{
-  duration_ = d;
-}
 
 Rhythmic_req::Rhythmic_req ()
 {
@@ -158,7 +156,13 @@ Rhythmic_req::duration () const
 {
   return duration_.length ();
 }
-/* *************** */
+
+void
+Rhythmic_req::compress (Moment m)
+{
+  duration_.compress (m);
+}
+  
 
 
 
@@ -170,12 +174,12 @@ Lyric_req::do_print () const
   Rhythmic_req::do_print ();
 }
 
-/* *************** */
 
 bool
 Note_req::do_equal_b (Request*r) const
 {
-  return Rhythmic_req::do_equal_b (r) && Melodic_req::do_equal_b (r);
+  Note_req *n = dynamic_cast<Note_req*> (r);
+  return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n);
 }
 
 
@@ -198,7 +202,6 @@ Note_req::do_print () const
   Rhythmic_req::do_print ();
 #endif
 }
-/* *************** */
 
 IMPLEMENT_IS_TYPE_B1 (Rest_req, Rhythmic_req);
 
@@ -208,7 +211,6 @@ Rest_req::do_print () const
       Rhythmic_req::do_print ();
 }
 
-/* *************** */
 
 
 
@@ -221,7 +223,6 @@ Multi_measure_rest_req::do_print () const
 }
 
 
-/* *************** */
 
 IMPLEMENT_IS_TYPE_B1 (Beam_req,Span_req);
 
@@ -234,7 +235,6 @@ Beam_req::do_print () const
 {
 }
 
-/* *************** */
 
 IMPLEMENT_IS_TYPE_B1 (Abbreviation_beam_req, Span_req);
 
@@ -266,13 +266,12 @@ Plet_req::do_print () const
 {
 }
 
-/* *************** */
 
 bool
 Span_req:: do_equal_b (Request*r) const
 {
-  Span_req * s = r->access_Span_req ();
-  return spantype == s->spantype;
+  Span_req * s = dynamic_cast <Span_req *> (r);
+  return s&& spantype == s->spantype;
 }
 
 Span_req::Span_req ()
@@ -280,7 +279,6 @@ Span_req::Span_req ()
   spantype = NOSPAN;
 }
 
-/* *************** */
 Script_req::Script_req (Script_req const&s)
 {
   dir_ = s.dir_;
@@ -295,9 +293,9 @@ Script_req::Script_req (Script_req const&s)
 bool
 Script_req::do_equal_b (Request*r) const
 {
-  Script_req * s = r->access_Script_req ();
+  Script_req * s = dynamic_cast <Script_req *> (r);
 
-  return  scriptdef_p_->equal_b (*s->scriptdef_p_);
+  return s&&  scriptdef_p_->equal_b (*s->scriptdef_p_);
 }
 
 Script_req::Script_req ()
@@ -332,7 +330,6 @@ Script_req::~Script_req ()
 {
   delete scriptdef_p_;
 }
-/* *************** */
 
 
 Text_req::~Text_req ()
@@ -365,7 +362,6 @@ Text_req::do_print () const
 #endif
 }
 
-/* *************** */
 
 
 IMPLEMENT_IS_TYPE_B1 (Skip_req,Musical_req);
@@ -405,8 +401,8 @@ Absolute_dynamic_req::do_print () const
 bool
 Absolute_dynamic_req::do_equal_b (Request *r) const
 {
-  Absolute_dynamic_req *a = r->access_Musical_req ()->access_Dynamic_req ()->access_Absolute_dynamic_req ();
-  return loudness_ == a->loudness_;
+  Absolute_dynamic_req *a = dynamic_cast <Absolute_dynamic_req *> (r);
+  return a&& loudness_ == a->loudness_;
 }
 
 String
@@ -454,9 +450,9 @@ Absolute_dynamic_req::Absolute_dynamic_req ()
 bool
 Span_dynamic_req::do_equal_b (Request *req) const
 {
-  Span_dynamic_req * s = req->access_Musical_req ()->access_Span_dynamic_req ();
+  Span_dynamic_req * s = dynamic_cast <Span_dynamic_req *> (req);
 
-  return Span_req::do_equal_b (req) && s->dynamic_dir_ == dynamic_dir_;
+  return s&& Span_req::do_equal_b (req) && s->dynamic_dir_ == dynamic_dir_;
 }
 
 Span_dynamic_req::Span_dynamic_req ()