]> git.donarmstrong.com Git - lilypond.git/blob - lily/scope.cc
52a185ee911b90f05a18f72dedd102b94e3b7c90
[lilypond.git] / lily / scope.cc
1 /*   
2   scope.cc --  implement Scope
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
7   
8  */
9
10 #include "scope.hh"
11 #include "assoc-iter.hh"
12 #include "debug.hh"
13 #include "identifier.hh"
14
15 void
16 Scope::print () const
17 {
18   bool init_b = false;          // ugh
19   for (Assoc_iter<String,Identifier*> ai (*this);  ai.ok(); ai++)
20     {
21       if (ai.val()->init_b_ == init_b)
22         {
23           DOUT << ai.key() << '=';
24           ai.val()->print ();
25         }
26     }
27 }
28
29 Scope::~Scope ()
30 {
31   for (Assoc_iter<String,Identifier*>    ai (*this); ai.ok(); ai++)
32     {
33       DOUT << "deleting: " << ai.key()<<'\n';
34       delete ai.val();
35     }
36 }
37
38 Scope::Scope (Scope const&s)
39   : Dictionary<Identifier*> (s)
40 {
41   for (Assoc_iter<String,Identifier*> ai (s); ai.ok(); ai++)
42     {
43       (*this)[ai.key ()] = ai.val ()->clone ();
44     }
45 }
46
47 Scope::Scope ()
48 {}