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];
}
-