Fix substitution error in shape noteheads
[lilypond/mpolesky.git] / lily / context-handle.cc
blob2a97bfcc51117ab7801c74230beba8f8741bad3d
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1999--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "context-handle.hh"
21 #include "context.hh"
23 Context_handle::Context_handle ()
25 outlet_ = 0;
28 Context_handle::Context_handle (Context_handle const &s)
30 outlet_ = 0;
31 if (s.outlet_)
32 up (s.outlet_);
35 Context_handle::~Context_handle ()
38 Don't do
40 if (outlet_)
41 down ();
43 with GC, this is asynchronous.
47 void
48 Context_handle::up (Context *t)
50 outlet_ = t;
51 t->iterator_count_++;
54 void
55 Context_handle::down ()
57 outlet_->iterator_count_--;
58 outlet_ = 0;
61 void
62 Context_handle::operator = (Context_handle const &s)
64 set_context (s.outlet_);
67 void
68 Context_handle::set_context (Context *trans)
70 if (outlet_ == trans)
71 return;
72 if (outlet_)
73 down ();
74 if (trans)
75 up (trans);
78 Context *
79 Context_handle::get_outlet () const
82 return outlet_;
85 int
86 Context_handle::get_count () const
88 return outlet_->iterator_count_;