]> git.donarmstrong.com Git - lilypond.git/blob - lily/interpretation-context-handle.cc
release: 1.3.56
[lilypond.git] / lily / interpretation-context-handle.cc
1 /*   
2
3   interpretation-context-handle.cc --  implement Interpretation_context_handle
4   
5   source file of the GNU LilyPond music typesetter
6   
7   (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8   
9  */
10
11 #include "interpretation-context-handle.hh"
12 #include "translator-group.hh"
13
14 void
15 Interpretation_context_handle::up (Translator_group*t)
16 {
17   report_to_l_ = t;
18   t->iterator_count_ ++;
19 }
20
21 void
22 Interpretation_context_handle::down()
23 {
24   report_to_l_->iterator_count_ --;
25   report_to_l_ = 0;
26 }
27
28 bool
29 Interpretation_context_handle::try_music (Music *m)
30 {
31   return  report_to_l_->try_music (m);
32 }
33
34 Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s)
35 {
36   report_to_l_ =0;
37   if (s.report_to_l_)
38     up (s.report_to_l_ );
39 }
40
41 void
42 Interpretation_context_handle::operator = (Interpretation_context_handle const &s)
43 {
44   set_translator (s.report_to_l_);
45 }
46
47 void
48 Interpretation_context_handle::set_translator (Translator_group*trans)
49 {
50   if (report_to_l_ ==trans)
51     return;
52   if (report_to_l_)
53     down ();
54   if (trans)
55     up (trans);
56 }
57
58 Translator_group*
59 Interpretation_context_handle::report_to_l ()const
60 {
61   return report_to_l_;
62 }
63
64 Interpretation_context_handle::Interpretation_context_handle()
65 {
66   report_to_l_ =0;
67 }
68
69 Interpretation_context_handle::~Interpretation_context_handle ()
70 {
71   if (report_to_l_)
72     down ();
73 }
74