lilypond-0.1.57
[lilypond.git] / lily / music-output-def.cc
blob297584d539bdccd0949f0868e458ebafe827565f
1 /*
2 music-output-def.cc -- implement Music_output_def
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 "music-output-def.hh"
11 #include "global-translator.hh"
12 #include "dictionary-iter.hh"
14 int
15 Music_output_def::get_next_default_count () const
17 return 0;
20 IMPLEMENT_IS_TYPE_B(Music_output_def);
22 Music_output_def::Music_output_def ()
26 Music_output_def::~Music_output_def ()
28 for (Dictionary_iter<Translator*> i (translator_p_dict_); i.ok (); i++)
29 delete i.val ();
32 Music_output_def::Music_output_def (Music_output_def const &s)
34 outfile_str_ = s.outfile_str_;
35 for (Dictionary_iter<Translator*> i (s.translator_p_dict_); i.ok (); i++)
36 assign_translator (i.key (), i.val ()->clone ());
39 Translator*
40 Music_output_def::find_translator_l (String name) const
42 if (translator_p_dict_.elt_b (name))
43 return translator_p_dict_[name];
45 if (global_translator_dict_p->elt_b (name))
46 return (*global_translator_dict_p)[name];
48 return 0;
52 Global_translator *
53 Music_output_def::get_global_translator_p ()
55 Translator * t = find_translator_l ("Score")->clone ();
56 Global_translator *g = t->group_l ()->global_l ();
57 t->add_processing ();
59 return g;
63 void
64 Music_output_def::assign_translator (String s, Translator*t)
66 t->type_str_ = s;
67 t->output_def_l_ = this;
69 if (translator_p_dict_.elt_b (s))
70 delete translator_p_dict_[s];
71 translator_p_dict_[s] = t;
74 void
75 Music_output_def::print () const
77 #ifndef NPRINT
78 for (Dictionary_iter<Translator*> i (translator_p_dict_); i.ok (); i++)
80 DOUT << i.key () << " = ";
81 i.val ()->print ();
83 DOUT << "output: " << outfile_str_;
84 #endif