lilypond-1.3.31
[lilypond.git] / lily / interpretation-context-handle.cc
blob185991b74807f18199b359fb3af017174d4a6116
1 /*
2 interpretation-context-handle.cc -- implement Interpretation_context_handle
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "interpretation-context-handle.hh"
11 #include "translator-group.hh"
13 void
14 Interpretation_context_handle::up (Translator_group*t)
16 report_to_l_ = t;
17 t->iterator_count_ ++;
20 void
21 Interpretation_context_handle::down()
23 report_to_l_->iterator_count_ --;
24 report_to_l_ = 0;
27 bool
28 Interpretation_context_handle::try_music (Music *m)
30 return report_to_l_->try_music (m);
33 Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s)
35 report_to_l_ =0;
36 if (s.report_to_l_)
37 up (s.report_to_l_ );
40 void
41 Interpretation_context_handle::operator = (Interpretation_context_handle const &s)
43 set_translator (s.report_to_l_);
46 void
47 Interpretation_context_handle::set_translator (Translator_group*trans)
49 if (report_to_l_ ==trans)
50 return;
51 if (report_to_l_)
52 down ();
53 if (trans)
54 up (trans);
57 Translator_group*
58 Interpretation_context_handle::report_to_l ()const
60 return report_to_l_;
63 Interpretation_context_handle::Interpretation_context_handle()
65 report_to_l_ =0;
68 Interpretation_context_handle::~Interpretation_context_handle ()
70 if (report_to_l_)
71 down ();