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);
}
}
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
{
{
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)
/* 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++)
{
}
}
- 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;
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;
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"));
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_;
}
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_;
}
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_;
}
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_;
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_;
}
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 =
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);
}
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 ();
}
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);
}
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;
}
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_);
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;
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);
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;
}
}
else
{
- key_C_ = &((Key_engraver*)result->access_Engraver ())->key_;
+ key_C_ = &((Key_engraver*)dynamic_cast <Engraver *> (result))->key_;
local_key_ = *key_C_;
}
}
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]);
}
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++)
{
}
}
- timing_req_l_arr_.push(c->access_Timing_req ());
+ timing_req_l_arr_.push(dynamic_cast <Timing_req *> (c));
return true;
}
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;
}
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_;
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 ())
{
else
time_.setpartial (m);
}
- else if (tr_l->access_Barcheck_req())
+ else if (dynamic_cast <Barcheck_req *> (tr_l))
{
if (time_.whole_in_measure_)
{
}
}
- 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_);
}
}