lilypond-1.3.74
[lilypond.git] / lily / scope.cc
blobc04878f93404c54865193ea6e60014e9224185df
1 /*
2 scope.cc -- implement Scope
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "scope.hh"
11 #include "identifier.hh"
12 #include "scm-hash.hh"
15 Scope::~Scope ()
17 delete id_dict_;
20 Scope::Scope (Scope const&s)
21 : id_dict_ (new Scheme_hash_table (*s.id_dict_))
25 Scope::Scope ()
27 id_dict_ = new Scheme_hash_table;
30 bool
31 Scope::elem_b (String s) const
33 return id_dict_->elem_b (ly_symbol2scm (s.ch_C()));
37 bool
38 Scope::elem_b (SCM s) const
40 return id_dict_->elem_b (s);
42 Identifier*
43 Scope::elem (SCM s)const
45 return unsmob_identifier (id_dict_->get (s));
48 SCM
49 Scope::scm_elem (SCM s)const
51 return id_dict_->get (s);
54 SCM
55 Scope::scm_elem (String s) const
57 return scm_elem (ly_symbol2scm (s.ch_C()));
60 Identifier*
61 Scope::elem (String s)const
63 return elem (ly_symbol2scm (s.ch_C()));
66 void
67 Scope::set (String s, SCM id)
69 return id_dict_->set (ly_symbol2scm (s.ch_C()), id);
72 void
73 Scope::set (String s, Identifier * id)
75 return id_dict_->set (ly_symbol2scm (s.ch_C()), smobify (id));
78 SCM
79 Scope::to_alist () const
81 return id_dict_->to_alist ();