* lily/music-iterator.cc (quit, do_quit): new function: break link
[lilypond.git] / lily / interpretation-context-handle.cc
blobe1da362bede56ddd820b44e2c254eb95e3545aaf
1 /*
2 interpretation-context-handle.cc -- implement Interpretation_context_handle
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2002 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_) report_to_->iterator_count_ --;
65 bool
66 Interpretation_context_handle::try_music (Music *m)
68 return report_to_->try_music (m);
71 void
72 Interpretation_context_handle::operator = (Interpretation_context_handle const &s)
74 set_translator (s.report_to_);
77 void
78 Interpretation_context_handle::set_translator (Translator_group*trans)
80 if (report_to_ ==trans)
81 return;
82 if (report_to_)
83 down ();
84 if (trans)
85 up (trans);
88 Translator_group*
89 Interpretation_context_handle::report_to ()const
92 return report_to_;