]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/notename-table.cc
release: 1.3.29
[lilypond.git] / lily / notename-table.cc
index 049f0cdfcb1ecbb495e67b71c8190a45d51dc8ef..f3a85c1ad671c12ed811a55568cc16d9321fd067 100644 (file)
@@ -3,26 +3,54 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "notename-table.hh"
-#include "pointer.tcc"
-#include "musical-request.hh"
+#include "dictionary-iter.hh"
+#include "dictionary.hh"
+#include "musical-pitch.hh"
+
+String
+Notename_table::get_name (Musical_pitch m) const
+{
+  for (Dictionary_iter<Musical_pitch> ai (*pitch_dict_); ai.ok (); ai++)
+    {
+      if (ai.val () == m)
+       return ai.key ();
+    }
+  return "r";                  // rest. 
+}
 
-template class P<Melodic_req>;
 
 void
-Notename_table::add (String s, Melodic_req *m_p)
+Notename_table::add_note_name (String s,
+                              Musical_pitch const *p)
 {
-  elem (s).set_p (m_p);
+  pitch_dict_->elem (s) = *p;
 }
 
-Melodic_req*
-Notename_table::get_l (String s)
+Notename_table::Notename_table ()
+{
+  pitch_dict_ = new Dictionary<Musical_pitch>;
+}
+
+Notename_table::~Notename_table()
+{
+  delete pitch_dict_;
+}
+
+Notename_table::Notename_table (Notename_table const &s)
+{
+  pitch_dict_ = new Dictionary<Musical_pitch> (*s.pitch_dict_);
+}
+bool
+Notename_table::elem_b (String s)const
+{
+  return pitch_dict_->elem_b (s);
+}
+Musical_pitch
+Notename_table::get_pitch (String s)const
 {
-  if (! elt_b (s))
-       return 0;
-  return elem (s);
+  return (*pitch_dict_)[s];
 }
-