lilypond-1.3.65
[lilypond.git] / lily / interpretation-context-handle.cc
blobb6a403ea2dcd05e64e2324890308993741db2364
1 /*
3 interpretation-context-handle.cc -- implement Interpretation_context_handle
5 source file of the GNU LilyPond music typesetter
7 (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 */
11 #include "interpretation-context-handle.hh"
12 #include "translator-group.hh"
14 void
15 Interpretation_context_handle::up (Translator_group*t)
17 report_to_l_ = t;
18 t->iterator_count_ ++;
21 void
22 Interpretation_context_handle::down()
24 report_to_l_->iterator_count_ --;
25 report_to_l_ = 0;
28 bool
29 Interpretation_context_handle::try_music (Music *m)
31 return report_to_l_->try_music (m);
34 Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s)
36 report_to_l_ =0;
37 if (s.report_to_l_)
38 up (s.report_to_l_ );
41 void
42 Interpretation_context_handle::operator = (Interpretation_context_handle const &s)
44 set_translator (s.report_to_l_);
47 void
48 Interpretation_context_handle::set_translator (Translator_group*trans)
50 if (report_to_l_ ==trans)
51 return;
52 if (report_to_l_)
53 down ();
54 if (trans)
55 up (trans);
58 Translator_group*
59 Interpretation_context_handle::report_to_l ()const
61 return report_to_l_;
64 Interpretation_context_handle::Interpretation_context_handle()
66 report_to_l_ =0;
69 Interpretation_context_handle::~Interpretation_context_handle ()
71 if (report_to_l_)
72 down ();