]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-def.cc
release: 1.3.42
[lilypond.git] / lily / paper-def.cc
index 233e2075d21c1f973c2a9e5f810794320ca47e98..9234da4d1c89b793c002e1932b9f34d50a487b54 100644 (file)
@@ -7,6 +7,7 @@
 */
 
 #include <math.h>
+
 #include "all-font-metrics.hh"
 #include "string.hh"
 #include "misc.hh"
 
 Paper_def::Paper_def ()
 {
-  lookup_p_tab_p_ = new Hash_table<int, Lookup*>;
-  lookup_p_tab_p_->hash_func_ = int_hash;
+  lookup_p_tab_p_ = new map<int, Lookup*>;
 }
 
 
 Paper_def::~Paper_def ()
 {
-  for (Hash_table_iter<int, Lookup*> ai(*lookup_p_tab_p_); ai.ok (); ai++)
+  for (map<int,Lookup*>::const_iterator ai = lookup_p_tab_p_->begin();
+       ai != lookup_p_tab_p_->end (); ai++)
     {
-      delete ai.val ();
+      delete (*ai).second;
     }
   
   delete lookup_p_tab_p_;
@@ -45,13 +46,13 @@ Paper_def::Paper_def (Paper_def const&s)
   : Music_output_def (s)
 {
   shape_int_a_ = s.shape_int_a_;
-  lookup_p_tab_p_ = new Hash_table<int, Lookup*>;
-  lookup_p_tab_p_->hash_func_ = int_hash;
+  lookup_p_tab_p_ = new map<int, Lookup*>;
   
-  for (Hash_table_iter<int, Lookup*> ai(*s.lookup_p_tab_p_); ai.ok (); ai++)
+  for (map<int,Lookup*>::const_iterator ai = s.lookup_p_tab_p_->begin();
+       ai != s.lookup_p_tab_p_->end (); ai++)
     {
-      Lookup * l = new Lookup (*ai.val ());
-      set_lookup (ai.key(), l);
+      Lookup * l = new Lookup (* (*ai).second);
+      set_lookup ((*ai).first, l);      
     }
 }
 
@@ -81,7 +82,7 @@ Paper_def::get_realvar (SCM s) const
 Interval
 Paper_def::line_dimensions_int (int n) const
 {
-  SCM s = default_properties_ [ly_symbol2scm ("margin-shape")];
+  SCM s = default_properties_.get (ly_symbol2scm ("margin-shape"));
   if (!gh_pair_p (s))
     {
       Real lw =  get_var ("linewidth");
@@ -112,9 +113,10 @@ Paper_def::line_dimensions_int (int n) const
 void
 Paper_def::set_lookup (int i, Lookup*l)
 {
-  if (lookup_p_tab_p_->elem_b (i))
+  map<int,Lookup*> :: const_iterator it (lookup_p_tab_p_->find (i));
+  if (it != lookup_p_tab_p_->end ())
     {
-      delete lookup_p_tab_p_->elem (i);
+      delete (*it).second;
     }
   (*lookup_p_tab_p_)[i] = l;
 }
@@ -139,9 +141,11 @@ Paper_def::print () const
 #ifndef NPRINT
   Music_output_def::print ();
   DEBUG_OUT << "Paper {";
-  for (Hash_table_iter<int, Lookup*> ai(*lookup_p_tab_p_); ai.ok (); ai++)
+  for (map<int,Lookup*>::const_iterator ai = lookup_p_tab_p_->begin();
+       ai != lookup_p_tab_p_->end (); ai++)
     {
-      DEBUG_OUT << "Lookup: " << ai.key () << " = " << ai.val ()->font_name_ << '\n';
+      DEBUG_OUT << "Lookup: " << (*ai).first
+               << " = " << (*ai).second->font_name_ << '\n';
     }
   DEBUG_OUT << "}\n";
 #endif