2002->2003
[lilypond.git] / lily / interpretation-context-handle.cc
blobef840ebf9a3de2d9113d3f0d724f14d4d0018d1e
1 /*
2 interpretation-context-handle.cc -- implement Interpretation_context_handle
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "interpretation-context-handle.hh"
10 #include "translator-group.hh"
12 Interpretation_context_handle::Interpretation_context_handle ()
14 report_to_ =0;
17 Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s)
19 report_to_ =0;
20 if (s.report_to_)
21 up (s.report_to_);
24 Interpretation_context_handle*
25 Interpretation_context_handle::clone () const
27 Interpretation_context_handle* handle = new Interpretation_context_handle;
28 handle->report_to_ = this->report_to_;
29 return handle;
32 Interpretation_context_handle::~Interpretation_context_handle ()
35 Don't do
37 if (report_to_)
38 down ();
40 with GC, this is asynchronous.
44 void
45 Interpretation_context_handle::up (Translator_group*t)
47 report_to_ = t;
48 t->iterator_count_ ++;
51 void
52 Interpretation_context_handle::down ()
54 report_to_->iterator_count_ --;
55 report_to_ = 0;
58 void
59 Interpretation_context_handle::quit ()
61 if (report_to_)
63 report_to_->iterator_count_ --;
64 report_to_ = 0;
68 bool
69 Interpretation_context_handle::try_music (Music *m)
71 return report_to_->try_music (m);
74 void
75 Interpretation_context_handle::operator = (Interpretation_context_handle const &s)
77 set_translator (s.report_to_);
80 void
81 Interpretation_context_handle::set_translator (Translator_group*trans)
83 if (report_to_ ==trans)
84 return;
85 if (report_to_)
86 down ();
87 if (trans)
88 up (trans);
91 Translator_group*
92 Interpretation_context_handle::report_to ()const
95 return report_to_;