]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/translator-group.hh
patch::: 1.0.12.hwn1
[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--1998 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 "plist.hh"
18 #include "parray.hh"
19
20 // egcs
21 typedef void (Translator::*Method_pointer)(void);
22 typedef void (Translator::*Const_method_pointer)(void) const; 
23
24 /** Make some kind of #Element#s from Requests. Elements are made by
25   hierarchically grouped #Translator#s
26   */
27 class Translator_group : public virtual Translator {
28   Array<String> consists_str_arr_;
29   Array<String> accepts_str_arr_;
30
31 public:
32   Pointer_list<Translator *> trans_p_list_;
33   String id_str_;
34
35
36   
37   
38   int iterator_count_;
39
40   TRANSLATOR_CLONE(Translator_group);
41   DECLARE_MY_RUNTIME_TYPEINFO;
42
43   void set_acceptor (String accepts, bool add);
44   void set_element (String accepts, bool add);  
45   
46   
47   Translator_group(Translator_group const &);
48   Translator_group();
49   void add_translator (Translator *trans_p);
50   
51   Link_array<Translator> nongroup_l_arr () const;
52   Link_array<Translator_group> group_l_arr () const;
53   
54   virtual Global_translator *global_l() { return 0; }
55   
56   /// Score_register = 0, Staff_registers = 1, etc)
57   Translator_group* ancestor_l (int l=1);
58   int depth_i() const;
59   bool is_bottom_translator_b () const;
60   bool removable_b() const;
61   void terminate_translator (Translator*r_l);
62   Translator *remove_translator_p (Translator*trans_l);
63   void check_removal ();
64
65
66   
67   Translator *get_simple_translator (char const *type) const;
68   Translator_group *find_existing_translator_l (String n, String id);
69   Translator_group *find_create_translator_l (String n, String id);
70   Link_array<Translator_group> path_to_acceptable_translator (String alias) const;
71
72   Translator_group*get_default_interpreter();
73 protected:
74   virtual ~Translator_group ();
75   virtual Translator_group * access_Translator_group () { return this; }
76   virtual void do_print () const;
77   virtual void do_process_requests ();
78   virtual void do_add_processing ();
79   virtual bool do_try_request (Request* req_l);       
80   virtual void do_pre_move_processing();
81   virtual void do_post_move_processing();   
82   virtual void do_creation_processing();
83   virtual void do_removal_processing();
84   void each (Method_pointer);
85   void each (Const_method_pointer) const;
86 };
87
88 #endif // TRANSLATOR_GROUP_HH