]> git.donarmstrong.com Git - lilypond.git/blob - src/inputscore.cc
release: 0.0.15
[lilypond.git] / src / inputscore.cc
1 #include "debug.hh"
2 #include "inputcommand.hh"
3 #include "inputscore.hh"
4 #include "inputstaff.hh"
5 #include "score.hh"
6 #include "paper.hh"
7
8 void
9 Input_score::add(svec<Input_command*> &s)
10 {
11     commands_.bottom().add(get_reset_command());
12     for (int i=0; i < s.sz(); i++)
13         commands_.bottom().add(s[i]);
14 }
15
16 void
17 Input_score::add(Input_staff*s)
18 {
19     staffs_.bottom().add(s);
20 }
21
22 void
23 Input_score::set(Paperdef*p)
24 {
25     delete paper_;
26     paper_ = p;
27 }
28
29 Score*
30 Input_score::parse()
31 {
32     Paperdef* p=new Paperdef(*paper_);
33     Score *s = new Score(p);
34     
35     for (PCursor<Input_staff*> i(staffs_); i.ok(); i++) {
36         Staff* staf=i->parse(commands_);
37         s->add(staf);
38     }
39     return s;
40 }
41
42 Input_score::~Input_score()
43 {
44     // should fix paper/symtabs to allow this deletion.
45 //    delete paper_;
46 }
47
48 Input_score::Input_score()
49 {
50     paper_= 0;
51 }
52
53 void
54 Input_score::print()const
55 {
56     mtor << "Input_score {\n";
57     for (PCursor<Input_staff*> i(staffs_); i.ok(); i++) {
58         i->print();
59     }
60     mtor << "}\n";
61 }