]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/translator.hh
patch::: 1.1.27.jcn3: geen genade
[lilypond.git] / lily / include / translator.hh
index 1684809af56aa5eae4511acecaf1aa9b481c9ee8..997735483ad6a0826cccc3b3ecaf5c96cf9309c4 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #include "parray.hh"
 #include "input.hh"
 
-#define TRANSLATOR_CLONE(c)    VIRTUAL_COPY_CONS(c, Translator)
 
 /** Make some kind of #Element#s from Requests. Elements are made by
   hierarchically grouped #Translator#s
   */
 class Translator : public Input {
-  Dictionary<Scalar> properties_dict_;
 public:
   Music_output_def * output_def_l_;
   String  type_str_;
@@ -32,8 +30,8 @@ public:
   bool is_alias_b (String) const;
   
 
-  DECLARE_MY_RUNTIME_TYPEINFO;  
-  TRANSLATOR_CLONE(Translator);
+    
+  VIRTUAL_COPY_CONS(Translator);
   Translator (Translator const &);
   Translator ();
   virtual ~Translator ();
@@ -51,7 +49,7 @@ public:
     true: request swallowed. Don't try to put the request elsewhere.
 
     */
-  bool try_request (Request*);
+  bool try_music (Music*);
   void pre_move_processing();
   void add_processing ();
   void creation_processing ();
@@ -61,14 +59,9 @@ public:
   /**
     ask daddy for a feature
     */
-  Scalar get_property (String type_str);
-  void set_property (String var_name, Scalar value);
   Music_output_def *output_def_l () const;
-  
-  virtual Moment now_moment () const;  
-  virtual Engraver *engraver_l () { return 0; }
-  virtual Performer *performer_l() { return 0; }
-  virtual Translator_group * group_l () { return 0; }
+  Scalar get_property (String, Translator_group **) const;
+  virtual Moment now_mom () const;  
 
 protected:
    enum { 
@@ -87,7 +80,7 @@ protected:
        Default: always return false
        */
   virtual void do_add_processing ();
-  virtual bool do_try_request (Request *req_l);
+  virtual bool do_try_music (Music *req_l);
   virtual void do_print () const;
   virtual void do_pre_move_processing(){}
   virtual void do_post_move_processing(){}
@@ -96,21 +89,27 @@ protected:
   virtual void do_removal_processing() {}
 };
 
+
+template<class T>
+class Translator_adder
+{
+public:
+  static Translator *ctor ()
+    {
+      T *t = new T;
+      t->type_str_ = classname (t);
+      return t;
+    }
+  Translator_adder () {        
+    add_constructor (ctor);
+  }                            
+};
+
 /**
   A macro to automate administration of translators.
  */
 #define ADD_THIS_TRANSLATOR(c)                         \
-struct c ## init {                                     \
-   static Translator *ctor ()\
-  {\
-        Translator *t = new c;\
-        t-> type_str_ = c::static_name ();\
-        return t;\
-    }\
-    c ## init() {                                      \
-       add_constructor (ctor);\
-    }                                                  \
-} _ ## c ## init;
+  Translator_adder<c> _ ## c ## init;
 
 typedef Translator *(*Translator_ctor) ();