Fix typo in convert-ly.
[lilypond.git] / lily / context-handle.cc
blob065a74f2d42ab3fbdc35400c1c402ecad84debd4
1 /*
2 context-handle.cc -- implement Context_handle
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "context-handle.hh"
10 #include "context.hh"
12 Context_handle::Context_handle ()
14 outlet_ = 0;
17 Context_handle::Context_handle (Context_handle const &s)
19 outlet_ = 0;
20 if (s.outlet_)
21 up (s.outlet_);
24 Context_handle::~Context_handle ()
27 Don't do
29 if (outlet_)
30 down ();
32 with GC, this is asynchronous.
36 void
37 Context_handle::up (Context *t)
39 outlet_ = t;
40 t->iterator_count_++;
43 void
44 Context_handle::down ()
46 outlet_->iterator_count_--;
47 outlet_ = 0;
50 void
51 Context_handle::operator = (Context_handle const &s)
53 set_context (s.outlet_);
56 void
57 Context_handle::set_context (Context *trans)
59 if (outlet_ == trans)
60 return;
61 if (outlet_)
62 down ();
63 if (trans)
64 up (trans);
67 Context *
68 Context_handle::get_outlet () const
71 return outlet_;
74 int
75 Context_handle::get_count () const
77 return outlet_->iterator_count_;