lilypond-1.3.28
[lilypond.git] / lily / registergroup.cc
bloba94f14560a9c9e24371407ed7027f37e8b69ea02
1 /*
2 registergroup.cc -- implement Register_group_register
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "proto.hh"
10 #include "plist.hh"
11 #include "registergroup.hh"
12 #include "register.hh"
14 bool
15 Register_group_register::acceptable_request_b(Request* r)
17 for (iter_top(reg_list_, i); i.ok(); i++) {
18 if (i->acceptable_request_b(r))
19 return true;
21 return false;
24 void
25 Register_group_register::set_feature(Features d)
27 for (iter_top(reg_list_, i); i.ok(); i++) {
28 i->set_feature(d);
32 void
33 Register_group_register::pre_move_processing()
35 for (iter_top(reg_list_, i); i.ok(); i++)
36 i->pre_move_processing();
39 void
40 Register_group_register::process_requests()
42 for (iter_top(reg_list_, i); i.ok(); i++)
43 i->process_requests();
46 void
47 Register_group_register::post_move_processing()
49 for (iter_top(reg_list_, i); i.ok(); i++)
50 i->post_move_processing();
53 void
54 Register_group_register::acknowledge_element(Staff_elem_info info)
56 if (!contains_b(info.origin_reg_l_arr_[0]))
57 return;
59 for (iter_top(reg_list_, i); i.ok(); i++)
60 i->acknowledge_element(info);
63 bool
64 Register_group_register::contains_b(Request_register* reg_l)
66 bool parent_b = Request_register::contains_b(reg_l);
68 if (parent_b)
69 return true;
70 for (iter_top(reg_list_, j); j.ok(); j++)
71 if (j->contains_b(reg_l))
72 return true;
73 return false;
78 bool
79 Register_group_register::try_request(Request*req_l)
81 for (iter_top(reg_list_, i); i.ok(); i++)
82 if (i->try_request(req_l))
83 return true;
84 return false;
87 void
88 Register_group_register::add(Request_register *reg_p)
90 reg_list_.bottom().add(reg_p);
91 reg_p->daddy_reg_l_ = this;
95 Register_group_register::~Register_group_register()
100 Request_register *
101 Register_group_register::get_register_p(Request_register*reg_l)
103 iterator(reg_list_) reg_cur= reg_list_.find(reg_l);
104 assert(reg_cur.ok());
105 return reg_cur.remove_p();
108 void
109 Register_group_register::terminate_register(Request_register*r_l)
111 delete get_register_p(r_l);
114 void
115 Register_group_register::do_print()const
117 #ifndef NPRINT
118 for (iter_top(reg_list_, i); i.ok(); i++)
119 i->print();
120 #endif