lilypond-1.3.122
[lilypond.git] / lily / input-score.cc
blob5ba571aefcf9b2030ac006cc487310c68926a56f
1 /*
2 input-score.cc -- implement Input_score
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "debug.hh"
10 #include "input-score.hh"
11 #include "input-staff.hh"
12 #include "input-music.hh"
13 #include "score.hh"
14 #include "paper-def.hh"
15 #include "midi-def.hh"
19 void
20 Input_score::add(Input_staff*s)
22 staffs_.bottom().add(s);
25 void
26 Input_score::set(Paper_def*p)
28 delete paper_p_;
29 paper_p_ = p;
32 void
33 Input_score::set(Midi_def* midi_p)
35 delete midi_p_;
36 midi_p_ = midi_p;
39 Input_score::Input_score(Input_score const&s)
40 : Input(s)
42 paper_p_ = (s.paper_p_)? new Paper_def(*s.paper_p_) :0;
43 midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_p_) : 0;
44 errorlevel_i_ = s.errorlevel_i_;
47 Score*
48 Input_score::parse()
50 Score *s_p = new Score;
52 s_p->errorlevel_i_ = errorlevel_i_;
53 if (midi_p_)
54 s_p->set(new Midi_def(*midi_p_));
55 if (paper_p_)
56 s_p->set(new Paper_def(*paper_p_));
58 for (iter_top(staffs_,i); i.ok(); i++) {
59 Staff* staf_p=i->parse(s_p);
60 s_p->add(staf_p);
63 return s_p;
67 Input_score::~Input_score()
69 delete paper_p_;
70 delete midi_p_;
73 Input_score::Input_score()
75 paper_p_= 0;
76 midi_p_ = 0;
77 errorlevel_i_ = 0;
80 void
81 Input_score::print()const
83 #ifndef NPRINT
84 mtor << "Input_score {\n";
85 for (iter_top(staffs_,i); i.ok(); i++) {
86 i->print();
88 mtor << "}\n";
89 #endif