2 lilypond-key.cc -- implement Lilypond_{grob,context}_key
4 source file of the GNU LilyPond music typesetter
6 (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "object-key.hh"
12 #include "lilypond-key.hh"
14 Lilypond_grob_key::Lilypond_grob_key (Object_key const *context,
17 int disambiguation_count)
20 creation_moment_ = start;
22 disambiguation_count_ = disambiguation_count;
26 Lilypond_grob_key::derived_mark () const
28 scm_gc_mark (context_->self_scm ());
32 Lilypond_grob_key::do_compare (Object_key const* key) const
34 Lilypond_grob_key const * other = dynamic_cast<Lilypond_grob_key const*> (key);
37 c = context_->compare (other->context_);
41 c = Moment::compare (creation_moment_, other->creation_moment_);
45 c = String::compare (grob_name_, other->grob_name_);
49 c = sign (disambiguation_count_ - other->disambiguation_count_);
58 Lilypond_grob_key::get_type () const
63 /****************************************************************/
67 Lilypond_context_key::derived_mark () const
70 scm_gc_mark (parent_context_->self_scm ());
73 Lilypond_context_key::Lilypond_context_key (Object_key const *parent,
79 disambiguation_count_ = count;
80 parent_context_ = parent;
81 start_moment_ = start;
88 Lilypond_context_key::do_compare (Object_key const *key) const
90 Lilypond_context_key const * other
91 = dynamic_cast<Lilypond_context_key const*> (key);
96 c = parent_context_->compare (other->parent_context_);
101 c = Moment::compare (start_moment_, other->start_moment_);
105 c = String::compare (context_name_, other->context_name_);
109 c = String::compare (id_, other->id_);
113 c = sign (disambiguation_count_ - other->disambiguation_count_);
121 Lilypond_context_key::get_type () const