]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/translator-group.hh
release: 1.3.0
[lilypond.git] / lily / include / translator-group.hh
1 /*
2   translator-group.hh -- declare Translator_group
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #ifndef TRANSLATOR_GROUP_HH
11 #define TRANSLATOR_GROUP_HH
12
13 #include "string.hh"
14 #include "lily-proto.hh"
15 #include "virtual-methods.hh"
16 #include "translator.hh"
17 #include "cons.hh"
18 #include "parray.hh"
19 #include "scm-hash.hh"
20
21
22 // egcs
23 typedef void (Translator::*Method_pointer)(void);
24 typedef void (Translator::*Const_method_pointer)(void) const; 
25
26 /** Make some kind of #Element#s from Requests. Elements are made by
27   hierarchically grouped #Translator#s
28   */
29 class Translator_group : public virtual Translator {
30   Array<String> consists_str_arr_;
31   Array<String> consists_end_str_arr_;
32   Array<String> accepts_str_arr_;
33   Scheme_hash_table properties_dict_;
34
35   int iterator_count_;
36   friend class Interpretation_context_handle;
37
38   Cons_list<Translator> trans_p_list_;
39
40 public:
41   SCM get_property (String type_str, Translator_group  **where_found_l) const;
42   void set_property (String var_name, SCM value);
43
44   String id_str_;
45
46   VIRTUAL_COPY_CONS(Translator);
47   
48   void set_acceptor (String accepts, bool add);
49   void set_element (String elt, bool add);  
50   void add_last_element (String elt);  
51   
52   Translator_group(Translator_group const &);
53   Translator_group();
54   void add_translator (Translator *trans_p);
55   
56   Link_array<Translator> nongroup_l_arr () const;
57   Link_array<Translator_group> group_l_arr () const;
58   
59   virtual Global_translator *global_l() { return 0; }
60   
61   /// Score_register = 0, Staff_registers = 1, etc)
62   Translator_group* ancestor_l (int l=1);
63   int depth_i() const;
64   bool is_bottom_translator_b () const;
65   bool removable_b() const;
66   void terminate_translator (Translator*r_l);
67   Translator *remove_translator_p (Translator*trans_l);
68   void check_removal ();
69
70
71
72   Translator *get_simple_translator (String) const;
73   Translator_group *find_existing_translator_l (String n, String id);
74   Translator_group *find_create_translator_l (String n, String id);
75   Link_array<Translator_group> path_to_acceptable_translator (String alias) const;
76
77   Translator_group*get_default_interpreter();
78   virtual ~Translator_group ();
79   
80 protected:
81   bool try_music_on_nongroup_children (Music *m);
82   
83   virtual void do_print () const;
84   virtual void do_process_requests ();
85   virtual void do_add_processing ();
86   virtual bool do_try_music (Music* req_l);       
87   virtual void do_pre_move_processing();
88   virtual void do_post_move_processing();   
89   virtual void do_creation_processing();
90   virtual void do_removal_processing();
91   virtual void each (Method_pointer);
92   virtual void each (Const_method_pointer) const;
93 };
94
95 #endif // TRANSLATOR_GROUP_HH