]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lilypond-key.cc
* flower
[lilypond.git] / lily / lilypond-key.cc
index cfe6a06caf0ea908445f67244570355068b8ec58..af4a521880688684769b3cf576a4f37ca6080084 100644 (file)
@@ -4,7 +4,6 @@
   source file of the GNU LilyPond music typesetter
 
   (c) 2004--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
 */
 
 #include "lilypond-key.hh"
@@ -28,15 +27,15 @@ Lilypond_grob_key::derived_mark () const
 
 // todo: reverse order of comparison for efficiency reasons.
 int
-Lilypond_grob_key::do_compare (Object_key constkey) const
+Lilypond_grob_key::do_compare (Object_key const *key) const
 {
-  Lilypond_grob_key const * other = dynamic_cast<Lilypond_grob_key const*> (key); 
+  Lilypond_grob_key const *other = dynamic_cast < Lilypond_grob_key const *> (key);
   int c;
 
   c = context_->compare (other->context_);
   if (c)
     return c;
-  
+
   c = Moment::compare (creation_moment_, other->creation_moment_);
   if (c)
     return c;
@@ -45,41 +44,37 @@ Lilypond_grob_key::do_compare (Object_key const* key) const
   if (c)
     return c;
 
-  c = sign (disambiguation_count_ - other->disambiguation_count_); 
+  c = sign (disambiguation_count_ - other->disambiguation_count_);
   if (c)
     return c;
-  
+
   return 0;
 }
 
-
 int
 Lilypond_grob_key::get_type () const
 {
   return GROB_KEY;
 }
 
-
 SCM
 Lilypond_grob_key::as_scheme () const
 {
-  return scm_list_4 (context_ ? context_->self_scm() : SCM_BOOL_F,
-                    creation_moment_.smobbed_copy(),
-                    scm_makfrom0str (grob_name_.to_str0()),
-                    scm_from_int (disambiguation_count_)); 
+  return scm_list_4 (context_ ? context_->self_scm () : SCM_BOOL_F,
+                    creation_moment_.smobbed_copy (),
+                    scm_makfrom0str (grob_name_.to_str0 ()),
+                    scm_from_int (disambiguation_count_));
 }
 
-
 Object_key *
-Lilypond_grob_key::from_scheme (SCM a) 
+Lilypond_grob_key::from_scheme (SCM a)
 {
   return new Lilypond_grob_key (unsmob_key (scm_car (a)),
                                *unsmob_moment (scm_cadr (a)),
-                               ly_scm2string  (scm_caddr (a)),
-                               scm_to_int  (scm_list_ref (a, scm_from_int (3))));
+                               ly_scm2string (scm_caddr (a)),
+                               scm_to_int (scm_list_ref (a, scm_from_int (3))));
 }
 
-
 /****************************************************************/
 
 void
@@ -102,12 +97,11 @@ Lilypond_context_key::Lilypond_context_key (Object_key const *parent,
   id_ = id;
 }
 
-
 int
 Lilypond_context_key::do_compare (Object_key const *key) const
 {
-  Lilypond_context_key const * other
-    = dynamic_cast<Lilypond_context_key const*> (key); 
+  Lilypond_context_key const *other
+    = dynamic_cast < Lilypond_context_key const *> (key);
 
   int c;
   if (parent_context_ && other->parent_context_)
@@ -117,11 +111,10 @@ Lilypond_context_key::do_compare (Object_key const *key) const
        return c;
     }
   else if (parent_context_)
-    return -1 ;
+    return -1;
   else if (other->parent_context_)
     return 1;
-  
-  
+
   c = Moment::compare (start_moment_, other->start_moment_);
   if (c)
     return c;
@@ -137,7 +130,7 @@ Lilypond_context_key::do_compare (Object_key const *key) const
   c = sign (disambiguation_count_ - other->disambiguation_count_);
   if (c)
     return c;
-  
+
   return 0;
 }
 
@@ -147,28 +140,26 @@ Lilypond_context_key::get_type () const
   return CONTEXT_KEY;
 }
 
-
 SCM
 Lilypond_context_key::as_scheme () const
 {
-  return scm_list_5 (parent_context_ ? parent_context_->self_scm() : SCM_BOOL_F,
-                    start_moment_.smobbed_copy(),
-                    scm_makfrom0str (context_name_.to_str0()),
-                    scm_makfrom0str (id_.to_str0()),
-                    scm_from_int (disambiguation_count_)); 
+  return scm_list_5 (parent_context_ ? parent_context_->self_scm () : SCM_BOOL_F,
+                    start_moment_.smobbed_copy (),
+                    scm_makfrom0str (context_name_.to_str0 ()),
+                    scm_makfrom0str (id_.to_str0 ()),
+                    scm_from_int (disambiguation_count_));
 }
 
 Object_key *
-Lilypond_context_key::from_scheme (SCM a) 
+Lilypond_context_key::from_scheme (SCM a)
 {
   return new Lilypond_context_key (unsmob_key (scm_car (a)),
                                   *unsmob_moment (scm_cadr (a)),
-                                  ly_scm2string  (scm_list_ref (a, scm_from_int (2))),
-                                  ly_scm2string  (scm_list_ref (a, scm_from_int (3))),
-                                  scm_to_int  (scm_list_ref (a, scm_from_int (4))));
+                                  ly_scm2string (scm_list_ref (a, scm_from_int (2))),
+                                  ly_scm2string (scm_list_ref (a, scm_from_int (3))),
+                                  scm_to_int (scm_list_ref (a, scm_from_int (4))));
 }
 
-
 /****************************************************************/
 
 int
@@ -184,26 +175,25 @@ Lilypond_general_key::derived_mark () const
     scm_gc_mark (parent_->self_scm ());
 }
 
-Lilypond_general_key::Lilypond_general_key (Object_key const*parent,
+Lilypond_general_key::Lilypond_general_key (Object_key const *parent,
                                            String name,
                                            int count)
 {
   parent_ = parent;
   name_ = name;
-  disambiguation_count_ = count; 
+  disambiguation_count_ = count;
 }
 
-
 int
-Lilypond_general_key::do_compare (Object_key constkey)const
+Lilypond_general_key::do_compare (Object_key const *key)const
 {
-  Lilypond_general_key constother
-    = dynamic_cast<Lilypond_general_key const*> (key);
+  Lilypond_general_key const *other
+    = dynamic_cast < Lilypond_general_key const *> (key);
 
   if (parent_ && other->parent_)
     parent_->compare (other->parent_);
   else if (parent_)
-    return -1 ;
+    return -1;
   else if (other->parent_)
     return 1;
 
@@ -215,21 +205,21 @@ Lilypond_general_key::do_compare (Object_key const* key)const
   if (c)
     return c;
 
-  return 0;  
+  return 0;
 }
 
 SCM
 Lilypond_general_key::as_scheme () const
 {
-  return scm_list_3 (parent_ ? parent_->self_scm() : SCM_BOOL_F,
-                    scm_makfrom0str (name_.to_str0()),
-                    scm_from_int (disambiguation_count_)); 
+  return scm_list_3 (parent_ ? parent_->self_scm () : SCM_BOOL_F,
+                    scm_makfrom0str (name_.to_str0 ()),
+                    scm_from_int (disambiguation_count_));
 }
 
 Object_key *
-Lilypond_general_key::from_scheme (SCM a) 
+Lilypond_general_key::from_scheme (SCM a)
 {
   return new Lilypond_general_key (unsmob_key (scm_car (a)),
-                                  ly_scm2string  (scm_list_ref (a, scm_from_int (1))),
-                                  scm_to_int  (scm_list_ref (a, scm_from_int (2))));
+                                  ly_scm2string (scm_list_ref (a, scm_from_int (1))),
+                                  scm_to_int (scm_list_ref (a, scm_from_int (2))));
 }