]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.0
authorfred <fred>
Tue, 26 Mar 2002 21:28:21 +0000 (21:28 +0000)
committerfred <fred>
Tue, 26 Mar 2002 21:28:21 +0000 (21:28 +0000)
lily/axis-group-item.cc
lily/axis-group-spanner.cc
lily/beam-engraver.cc
lily/command-request.cc
lily/engraver-group.cc
lily/head-engraver.cc
lily/heads-engraver.cc
lily/key-performer.cc
lily/local-key-engraver.cc
lily/timing-translator.cc

index 33dfdceba995273b38f630275febd21a58654d6f..273116d1ea1ef8d8de756902dfb8bca7d66ea537 100644 (file)
@@ -16,7 +16,7 @@ Axis_group_item::OK() const
   Link_array<Score_element> elems = elem_l_arr ();
   for (int i=0; i < elems.size(); i++) 
     {
-      Item * it_l = elems[i]->access_Item ();
+      Item * it_l = dynamic_cast<Item*> (elems[i]);
       assert (it_l);
     }
 }
@@ -34,7 +34,7 @@ Axis_group_item::do_breakable_col_processing()
   Link_array<Score_element> elems = elem_l_arr ();
   for (int i=0; i < elems.size(); i++) 
     {
-      Item* it_l = elems[i]->access_Item ();
+      Item* it_l = dynamic_cast<Item*> (elems[i]);
       Direction  j=LEFT;
       do 
        {
index 64a28da895b44eeb6d0a3a6bf22b1695edc96924..70c70c297f063bee6db0af7b60a6fd1e89900441 100644 (file)
@@ -24,7 +24,7 @@ Axis_group_spanner::do_break_processing_if_unbroken()
     {
       if (!elems[i]->line_l()) 
        {
-         Item * item_l = elems[i]->access_Item ();
+         Item * item_l = dynamic_cast<Item*> (elems[i]);
          if  (item_l
               && item_l->breakable_b_ 
               && item_l->break_status_dir() == 0) 
@@ -65,9 +65,9 @@ Axis_group_spanner::do_break_processing()
          /* this piece doesn't know where it belongs.
             Find out if it was broken, and use the broken remains
             */
-         if (elt->access_Spanner ()) 
+         if (dynamic_cast <Spanner *> (elt)) 
            {
-             Spanner * sp = elt->access_Spanner ();
+             Spanner * sp = dynamic_cast <Spanner *> (elt);
                
              for (int j =0; j < broken_into_l_arr_.size(); j++) 
                {
@@ -83,15 +83,15 @@ Axis_group_spanner::do_break_processing()
                    
                }
            }
-         else if (elt->access_Item (
-                  && elt->access_Item ()->breakable_b_ 
-                  && elt->access_Item ()->break_status_dir () == 0) 
+         else if (dynamic_cast <Item *> (elt
+                  && dynamic_cast <Item *> (elt)->breakable_b_ 
+                  && dynamic_cast <Item *> (elt)->break_status_dir () == 0) 
            {
              // broken items
              Direction  j=LEFT;
              do 
                {
-                 Item * my_item = elt->access_Item ()->broken_to_drul_[j];
+                 Item * my_item = dynamic_cast <Item *> (elt)->broken_to_drul_[j];
                  Line_of_score * item_line_l = my_item->line_l() ;
                  if (! item_line_l) 
                    continue;
index 6ef0ba09fc68ec873e7f2b090f353ba24cfc3b7c..4ef398b499110aef61d9ee5a319586374c11ed3c 100644 (file)
@@ -25,11 +25,11 @@ Beam_engraver::Beam_engraver()
 bool
 Beam_engraver::do_try_request(Request*r)
 {
-  Musical_req* mus_l = r->access_Musical_req ();
+  Musical_req* mus_l = dynamic_cast <Musical_req *> (r);
   if (!mus_l)
     return false;
 
-  Beam_req* b = mus_l->access_Beam_req ();
+  Beam_req* b = dynamic_cast <Beam_req *> (mus_l);
   if (!b)
     return false;
 
@@ -100,14 +100,14 @@ Beam_engraver::acknowledge_element (Score_element_info i)
   if (!beam_p_ || !i.elem_l_->is_type_b (Stem::static_name ()))
     return;
 
-  Stem* s = (Stem*)i.elem_l_->access_Item ();
-  if (!i.req_l_ || !i.req_l_->access_Musical_req () || !i.req_l_->access_Musical_req ()->access_Rhythmic_req ())
+  Stem* s = (Stem*)dynamic_cast <Item *> (i.elem_l_);
+  if (!dynamic_cast <Rhythmic_req *> (i.req_l_))
     {
       ::warning ( _("Stem must have Rhythmic structure."));
       return;
     }
 
-  Rhythmic_req *rhythmic_req = i.req_l_->access_Musical_req ()->access_Rhythmic_req ();
+  Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (i.req_l_);
   if (rhythmic_req->duration_.durlog_i_<= 2)
     {
       rhythmic_req->warning (_ ("stem doesn't fit in beam"));
index b32dc96ff4da33a1bf75004ad68ad85e7db293fa..e407f30661c759d029d3e3b8a56fb9e3dd9fc49e 100644 (file)
@@ -32,7 +32,7 @@ Cadenza_req::do_print() const
 bool
 Cadenza_req::do_equal_b (Request*r) const
 {
-  Cadenza_req*cad =  r->access_Command_req ()->access_Timing_req ()->access_Cadenza_req ();
+  Cadenza_req*cad =  dynamic_cast <Cadenza_req *> (r);
 
   return cad->on_b_ == on_b_;
 }
@@ -47,7 +47,7 @@ Cadenza_req::Cadenza_req (bool b)
 bool
 Bar_req::do_equal_b (Request*r) const
 {
-  Bar_req * b = r->access_Command_req ()->access_Bar_req ();
+  Bar_req * b = dynamic_cast <Bar_req *> (r);
   return type_str_ == b->type_str_;
 }
 
@@ -81,7 +81,7 @@ Partial_measure_req::Partial_measure_req (Moment m)
 bool
 Partial_measure_req::do_equal_b (Request* r) const
 {
-  Partial_measure_req *p = r->access_Command_req ()->access_Timing_req ()->access_Partial_measure_req ();
+  Partial_measure_req *p = dynamic_cast <Partial_measure_req *> (r);
 
   return p->duration_ == duration_;
 }
@@ -150,7 +150,7 @@ Time_signature_change_req::do_print() const
 bool
 Time_signature_change_req::do_equal_b (Request * r) const
 {
-  Time_signature_change_req * m = r->access_Command_req ()->access_Timing_req ()->access_Time_signature_change_req ();
+  Time_signature_change_req * m = dynamic_cast <Time_signature_change_req *> (r);
 
   return m->beats_i_ == beats_i_
     && one_beat_i_ == m->one_beat_i_;
@@ -179,7 +179,7 @@ IMPLEMENT_IS_TYPE_B1(Tempo_req, Timing_req);
 bool
 Tempo_req::do_equal_b (Request *r) const
 {
-  Tempo_req *t = r->access_Command_req ()->access_Timing_req ()->access_Tempo_req ();
+  Tempo_req *t = dynamic_cast <Tempo_req *> (r);
 
   return t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_;
 }
index 2dc0b4131b24b756dbea75a0007be88550f43d2d..2c1b3d2d863502a5f705a997a5ad94f44659f5f1 100644 (file)
@@ -30,7 +30,7 @@ Engraver_group_engraver::do_announces()
   Link_array<Translator_group> groups = group_l_arr ();
   for (int i=0; i < groups.size(); i++) 
     {
-      Engraver * eng = groups[i]->access_Engraver  ();
+      Engraver * eng = dynamic_cast<Engraver*> (groups[i]);
       if (eng)
        {
          Engraver_group_engraver * group =
@@ -52,7 +52,7 @@ Engraver_group_engraver::do_announces()
            info.req_l_ = &dummy_req;
          for (int i=0; i < nongroups.size(); i++) 
            {   // Is this good enough?
-             Engraver * eng = nongroups[i]->access_Engraver  ();
+             Engraver * eng = dynamic_cast<Engraver*> (nongroups[i]);
              if (eng && eng!= info.origin_grav_l_arr_[0])
                eng->acknowledge_element (info);
            }
@@ -60,7 +60,7 @@ Engraver_group_engraver::do_announces()
       announce_info_arr_.clear ();
       for (int i=0; i < nongroups.size(); i++)
        {
-         Engraver * eng = nongroups[i]->access_Engraver  ();
+         Engraver * eng = dynamic_cast<Engraver*> (nongroups[i]);
          if (eng)
            eng->process_acknowledged ();
        }
@@ -77,7 +77,7 @@ Engraver_group_engraver::get_staff_info() const
   Link_array<Translator> simple_translators = nongroup_l_arr (); 
   for (int i=0; i < simple_translators.size(); i++)
     {
-    Engraver * eng = simple_translators[i]->access_Engraver  ();
+    Engraver * eng = dynamic_cast<Engraver*> (simple_translators[i]);
     if (eng)
       eng->fill_staff_info (inf);
     }
index c8c5e79248ad7183917d1ecd4e8254bded496126..ce4e5dcdf37bbd3439f20c76fc70f5bf3652d3dd 100644 (file)
@@ -23,11 +23,10 @@ Note_head_engraver::do_try_request (Request *req_l)
   if (note_req_l_)
     return false;
   
-  if (!(req_l->access_Musical_req () && req_l->access_Musical_req ()->access_Note_req ()))
-
+  if (!(dynamic_cast <Note_req *> (req_l)))
     return false;
   
-  note_req_l_=req_l->access_Musical_req ()->access_Rhythmic_req ();
+  note_req_l_=dynamic_cast <Rhythmic_req *> (req_l);
   return true;
 }
 
@@ -47,7 +46,7 @@ Note_head_engraver::do_process_requests()
       announce_element (Score_element_info (dot_p_,0));
     }
   
-  note_p_->position_i_ = note_req_l_->access_Note_req ()->pitch_.steps ();
+  note_p_->position_i_ = dynamic_cast <Note_req *> (note_req_l_)->pitch_.steps ();
 
   
   Score_element_info itinf (note_p_,note_req_l_);
index 63e192ea06635c597d4196dd226201b13e6c935f..a8e0aaa46b8e43f9edead8176020730159c64d0a 100644 (file)
@@ -18,10 +18,10 @@ Note_heads_engraver::Note_heads_engraver()
 bool
 Note_heads_engraver::do_try_request (Request *req_l) 
 {
-  if (!req_l->access_Musical_req ()) 
+  if (!dynamic_cast <Musical_req *> (req_l)) 
     return false;
 
-  Note_req * n =req_l->access_Musical_req ()->access_Note_req ();
+  Note_req * n =dynamic_cast <Note_req *> (req_l);
   if (!n)
     return false;
   
@@ -49,7 +49,7 @@ Note_heads_engraver::do_process_requests()
          dot_p_arr_.push (d);
        }
 
-      note_p->position_i_ = note_req_l->access_Note_req ()->pitch_.steps ();
+      note_p->position_i_ = dynamic_cast <Note_req *> (note_req_l)->pitch_.steps ();
 
   
       Score_element_info itinf (note_p,note_req_l);
index 02e80fca2891fe469aec3c8005cb28d41f8a6b75..3ccac03e21537a71d0b589984c1624838e53638c 100644 (file)
@@ -47,11 +47,11 @@ Key_performer::do_try_request (Request* req_l)
   if (key_req_l_)
        return false;
 
-  if (req_l->access_Command_req ())
-       key_req_l_ = req_l->access_Command_req ()->access_Key_change_req ();
-
-  if (key_req_l_)
-       return true;
+  if (dynamic_cast <Key_change_req *> (req_l))
+    {
+      key_req_l_ = dynamic_cast <Key_change_req*> (req_l);
+      return true;
+    }
 
   return false;
 }
index c6a3a0718946faf0113bf6daa1869bd7fa7f19ee..54df397c45339fde06195a0472f54f8ce255b008 100644 (file)
@@ -40,7 +40,7 @@ Local_key_engraver::do_creation_processing ()
     }
   else
     {
-      key_C_ = &((Key_engraver*)result->access_Engraver  ())->key_;
+      key_C_ = &((Key_engraver*)dynamic_cast <Engraver *> (result))->key_;
       local_key_ = *key_C_;
     }
 }
@@ -97,24 +97,22 @@ void
 Local_key_engraver::acknowledge_element (Score_element_info info)
 {    
   Score_element * elem_l = info.elem_l_;
-  Item * item_l = elem_l->access_Item();
+  Item * item_l = dynamic_cast <Item *> (elem_l);
 
-  Note_req * note_l = (info.req_l_->access_Musical_req ())
-    ? info.req_l_->access_Musical_req ()->access_Note_req () : 0;
+  Note_req * note_l =  dynamic_cast <Note_req *> (info.req_l_);
 
   if (note_l &&  item_l && item_l->is_type_b (Note_head::static_name ()))
     {
       mel_l_arr_.push (note_l);
       support_l_arr_.push (item_l);
     }
-  else if (info.req_l_->access_Command_req ()
-          && info.req_l_->access_Command_req ()->access_Key_change_req () && key_C_) 
+  else if (dynamic_cast <Key_change_req*> (info.req_l_))
     {
       local_key_ = *key_C_;
     }
   else if (elem_l->is_type_b (Tie::static_name ())) 
     {
-      Tie * tie_l = (Tie*)elem_l->access_Spanner ();
+      Tie * tie_l = (Tie*)dynamic_cast <Spanner *> (elem_l);
       if (tie_l->same_pitch_b_)
        tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]);
     }
index 79dd64035ca88c8198f7f4bfe9fbbf3cf2dcd0d7..316f31d52363d3a00fac0cd6df8a1e0511a00aa7 100644 (file)
@@ -20,8 +20,8 @@ Timing_translator::Timing_translator ()
 bool
 Timing_translator::do_try_request(Request*r)
 {
-  Command_req * c = r->access_Command_req ();
-  if (!(c && c->access_Timing_req ()))
+  Command_req * c = dynamic_cast <Command_req *> (r);
+  if (!(c && dynamic_cast <Timing_req *> (c)))
     return false;
   for (int i=0; i < timing_req_l_arr_.size (); i++)
     {
@@ -34,7 +34,7 @@ Timing_translator::do_try_request(Request*r)
        }
     }
 
-  timing_req_l_arr_.push(c->access_Timing_req ());
+  timing_req_l_arr_.push(dynamic_cast <Timing_req *> (c));
   return true;
 }
 
@@ -44,7 +44,7 @@ Timing_translator::time_signature_req_l() const
   Time_signature_change_req *m_l=0;
   for (int i=0; !m_l && i < timing_req_l_arr_.size (); i++)
     {
-      m_l=timing_req_l_arr_[i]->access_Time_signature_change_req ();
+      m_l=dynamic_cast<Time_signature_change_req*> (timing_req_l_arr_[i]);
     }
   return m_l;
 }
@@ -55,7 +55,7 @@ Timing_translator::do_process_requests()
   for (int i=0; i < timing_req_l_arr_.size (); i++)
     {
       Timing_req * tr_l = timing_req_l_arr_[i];
-      Time_signature_change_req *m_l = tr_l->access_Time_signature_change_req ();
+      Time_signature_change_req *m_l = dynamic_cast <Time_signature_change_req *> (tr_l);
       if (m_l)
        {
          int b_i= m_l->beats_i_;
@@ -69,9 +69,9 @@ Timing_translator::do_process_requests()
                Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)), b_i);
            }
        }
-      else if (tr_l->access_Partial_measure_req ())
+      else if (dynamic_cast <Partial_measure_req *> (tr_l))
        {
-         Moment m = tr_l->access_Partial_measure_req ()->duration_;
+         Moment m = dynamic_cast <Partial_measure_req *> (tr_l)->duration_;
          String error = time_.try_set_partial_str (m);
          if (error.length_i ())
            {
@@ -80,7 +80,7 @@ Timing_translator::do_process_requests()
          else
            time_.setpartial (m);
        }
-      else if (tr_l->access_Barcheck_req())
+      else if (dynamic_cast <Barcheck_req *> (tr_l))
        {
          if (time_.whole_in_measure_)
            {
@@ -92,15 +92,15 @@ Timing_translator::do_process_requests()
            }
 
        }
-      else if (tr_l->access_Cadenza_req ())
+      else if (dynamic_cast <Cadenza_req *> (tr_l))
        {
-         time_.set_cadenza (tr_l->access_Cadenza_req ()->on_b_);
+         time_.set_cadenza (dynamic_cast <Cadenza_req *> (tr_l)->on_b_);
        }
-      else if (tr_l->access_Measure_grouping_req ())
+      else if (dynamic_cast <Measure_grouping_req *> (tr_l))
        {
          default_grouping_ =
-           parse_grouping (tr_l->access_Measure_grouping_req ()->beat_i_arr_,
-                           tr_l->access_Measure_grouping_req ()->elt_length_arr_);
+           parse_grouping (dynamic_cast <Measure_grouping_req *> (tr_l)->beat_i_arr_,
+                           dynamic_cast <Measure_grouping_req *> (tr_l)->elt_length_arr_);
 
        }
     }