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