]> git.donarmstrong.com Git - lilypond.git/blob - lily/input-register.cc
711b89bd6d57c8800d14d92259eb374c084fac28
[lilypond.git] / lily / input-register.cc
1 /*
2   input-register.cc -- implement Input_register
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8 #include "debug.hh"
9 #include "register.hh"
10 #include "input-register.hh"
11 Input_register::~Input_register()
12 {}
13
14 Input_register::Input_register()
15 {
16 }
17
18 bool
19 Input_register::group_b()const
20 {
21     return ireg_list_.size();
22 }
23
24 Array<String>
25 Input_register::get_nongroups_str_arr()const
26 {
27     Array<String> s_arr;
28     for (iter_top(ireg_list_, i); i.ok(); i++) {
29         if (!i->group_b())
30             s_arr.push(i->name_str_);
31     }
32     return s_arr;
33 }
34
35 Input_register*
36 Input_register::get_ireg_l(String nm)const
37 {
38     for (iter_top(ireg_list_, i); i.ok(); i++) {
39         if (i->name_str_ == nm)
40             return i;
41     }
42     return 0;
43 }
44 Array<Request_register*>
45 Input_register::get_nongroup_p_arr() const 
46 {
47     Array <Request_register*>a;
48     Array<String> sa(get_nongroups_str_arr());
49     for (int i=0; i < sa.size(); i++)
50         a.push(get_nongroup_register_p(sa[i]));
51     return a;
52 }
53
54 void
55 Input_register::add(Input_register *p)
56 {
57     ireg_list_.bottom().add(p);
58 }
59
60 void
61 Input_register::print() const
62 {
63 #ifndef NPRINT
64     mtor << name_str_ << " { ";
65     for (iter_top(ireg_list_, i); i.ok(); i++)
66         i->print();
67     mtor <<" }\n";
68 #endif 
69 }
70         
71
72 Input_register::Input_register(Input_register const&s)
73     : Input(s)
74 {
75     name_str_ = s.name_str_;
76     for (iter_top(s.ireg_list_, i); i.ok(); i++)
77         add(new Input_register(*i.ptr()));
78 }