]> git.donarmstrong.com Git - lilypond.git/blob - lily/input-staff.cc
release: 0.0.46.jcn1
[lilypond.git] / lily / input-staff.cc
1 /*
2   input-staff.cc -- implement Input_staff
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "debug.hh"
10 #include "score.hh"
11 #include "input-music.hh"
12 #include "input-staff.hh"
13 #include "staff.hh"
14 #include "complex-staff.hh"
15 #include "my-lily-lexer.hh"
16 #include "input-register.hh"
17
18 Input_staff::Input_staff()
19 {
20     ireg_p_ =0;
21 }
22
23 void
24 Input_staff::add(Input_music*m)
25 {
26     music_.bottom().add(m);
27 }
28
29 Staff*
30 Input_staff::parse(Score*score_l)
31 {
32     Staff *p=new Complex_staff;
33    
34     p->score_l_ = score_l;
35     p->ireg_p_ = (ireg_p_)? new Input_register(*ireg_p_):0;
36     for (iter_top(music_,i); i.ok(); i++) {
37         Voice_list vl = i->convert();
38         p->add(vl);
39     }
40     return p;
41 }
42
43 Input_staff::Input_staff(Input_staff const&s)
44     : Input(s)
45 {    
46     for (iter_top(s.music_,i); i.ok(); i++)
47         add(i->clone());
48
49     ireg_p_ = (s.ireg_p_)? new Input_register(*s.ireg_p_):0;
50 }
51
52 void
53 Input_staff::print() const
54 {
55 #ifndef NPRINT
56     mtor << "Input_staff {\n";
57     for (iter_top(music_,i); i.ok(); i++)
58         i->print();
59     ireg_p_->print();
60     mtor << "}\n";
61 #endif
62 }
63 Input_staff::~Input_staff()
64 {
65     delete ireg_p_;
66 }