X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finterpretation-context-handle.cc;h=e7af7e85bf80e72af605114684153c2bc2efe895;hb=90f11558943cc2381d2eae4d64029a0f8572f144;hp=b6a403ea2dcd05e64e2324890308993741db2364;hpb=5175fb07679b964a62202f6c900451e88d120f69;p=lilypond.git diff --git a/lily/interpretation-context-handle.cc b/lily/interpretation-context-handle.cc index b6a403ea2d..e7af7e85bf 100644 --- a/lily/interpretation-context-handle.cc +++ b/lily/interpretation-context-handle.cc @@ -1,74 +1,95 @@ /* - interpretation-context-handle.cc -- implement Interpretation_context_handle source file of the GNU LilyPond music typesetter - (c) 1999--2000 Han-Wen Nienhuys - + (c) 1999--2004 Han-Wen Nienhuys */ #include "interpretation-context-handle.hh" -#include "translator-group.hh" +#include "context.hh" + +Interpretation_context_handle::Interpretation_context_handle () +{ + outlet_ =0; +} + +Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s) +{ + outlet_ =0; + if (s.outlet_) + up (s.outlet_); +} + + +Interpretation_context_handle::~Interpretation_context_handle () +{ + /* + Don't do + + if (outlet_) + down (); + + with GC, this is asynchronous. + */ +} void -Interpretation_context_handle::up (Translator_group*t) +Interpretation_context_handle::up (Context *t) { - report_to_l_ = t; + outlet_ = t; t->iterator_count_ ++; } void -Interpretation_context_handle::down() +Interpretation_context_handle::down () { - report_to_l_->iterator_count_ --; - report_to_l_ = 0; + outlet_->iterator_count_ --; + outlet_ = 0; } -bool -Interpretation_context_handle::try_music (Music *m) +void +Interpretation_context_handle::quit () { - return report_to_l_->try_music (m); + if (outlet_) + { + outlet_->iterator_count_ --; + outlet_ = 0; + } } -Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s) +bool +Interpretation_context_handle::try_music (Music *m) { - report_to_l_ =0; - if (s.report_to_l_) - up (s.report_to_l_ ); + return outlet_->try_music (m); } void Interpretation_context_handle::operator = (Interpretation_context_handle const &s) { - set_translator (s.report_to_l_); + set_translator (s.outlet_); } void -Interpretation_context_handle::set_translator (Translator_group*trans) +Interpretation_context_handle::set_translator (Context *trans) { - if (report_to_l_ ==trans) + if (outlet_ ==trans) return; - if (report_to_l_) + if (outlet_) down (); if (trans) up (trans); } -Translator_group* -Interpretation_context_handle::report_to_l ()const +Context * +Interpretation_context_handle::get_outlet () const { - return report_to_l_; + + return outlet_; } -Interpretation_context_handle::Interpretation_context_handle() +int +Interpretation_context_handle::get_count () const { - report_to_l_ =0; + return outlet_->iterator_count_ ; } - -Interpretation_context_handle::~Interpretation_context_handle () -{ - if (report_to_l_) - down (); -} -