]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/identifier.hh
release: 0.1.11
[lilypond.git] / lily / include / identifier.hh
index 1aa7f7d0c4982c12ea3feec1387c78d2532a49ae..935f962e39df71e631c85714755f154c34295025 100644 (file)
@@ -1,42 +1,76 @@
-
 /*
-  identifier.hh -- part of LilyPond
+  identifier.hh -- part of GNU LilyPond
 
   (c) 1996,97 Han-Wen Nienhuys
 */
 
 #ifndef IDENTIFIER_HH
 #define IDENTIFIER_HH
-#include "identparent.hh"
-#include "symtable.hh"
-#include "input-staff.hh"
-#include "input-music.hh"
-#include "notename.hh"
-#include "lookup.hh"
-#include "script-def.hh"
-
-#define make_id_class(Idclass, Class, accessor)        \
+
+#include "lily-proto.hh"
+#include "string.hh"
+#include "input.hh"
+#include "virtual-methods.hh"
+
+#define IDACCESSOR( Input_staff, staff)\
+    virtual Input_staff * staff () { error (#Input_staff); return 0; }
+
+/**
+   A declarable data structure in mudela. 
+
+
+   */
+struct Identifier : public Input {
+    bool init_b_;
+    bool accessed_b_;
+    int token_code_i_;
+    
+    Identifier (int code) ;
+    virtual ~Identifier() ;
+
+    void print() const;
+    DECLARE_MY_RUNTIME_TYPEINFO;
+    void error (String);
+    IDACCESSOR(Input_translator, input_translator)
+    IDACCESSOR(Music, music)
+    IDACCESSOR(General_script_def, script)
+    IDACCESSOR(Symtables, symtables)
+    IDACCESSOR(Midi_def, mididef)
+    IDACCESSOR(Paper_def, paperdef)
+    IDACCESSOR(Lookup,lookup)
+    IDACCESSOR(Real,real)
+    IDACCESSOR(Request, request)
+    IDACCESSOR(Score, score)
+    IDACCESSOR(int, intid)
+    IDACCESSOR(Duration, duration)
+
+protected:
+    virtual void do_print() const=0;
+private:
+    Identifier (Identifier const&);
+};
+
+#define DECLARE_ID_CLASS(Idclass, Class, accessor)     \
 struct Idclass : Identifier {\
-    virtual const char *classname() { return #Class; }\
-    Idclass(String s, Class*st):Identifier(s) { data = st; }\
-    virtual Class* accessor(bool copy) {\
-       if (copy)\
-           return new Class(* (Class*) data);\
-       else\
-           return (Class*) data;\
-    }\
-    ~Idclass() { delete accessor(false); }\
-    virtual void do_print()const; \
+       Class *data_p_;              \
+        DECLARE_MY_RUNTIME_TYPEINFO;                       \
+       Idclass (Class*st, int code);\
+       virtual Class* accessor ();\
+       ~Idclass();\
+       virtual void do_print() const; \
 }\
 
-make_id_class(Real_id, Real, real);
-make_id_class(Script_id, Script_def, script);
-make_id_class(Lookup_id, Lookup, lookup);
-make_id_class(Symtables_id, Symtables, symtables);
-make_id_class(Staff_id, Input_staff, staff);
-make_id_class(M_chord_id, Music_general_chord, mchord);
-make_id_class(M_voice_id, Music_voice, mvoice);
-make_id_class(Notetab_id, Notename_tab, notename_tab);
-
-#endif // IDENTIFIER_HH
 
+DECLARE_ID_CLASS(Input_translator_id, Input_translator, input_translator);
+DECLARE_ID_CLASS(Duration_id, Duration, duration);
+DECLARE_ID_CLASS(Real_id, Real, real);
+DECLARE_ID_CLASS(Script_id, General_script_def, script);
+DECLARE_ID_CLASS(Lookup_id, Lookup, lookup);
+DECLARE_ID_CLASS(Symtables_id, Symtables, symtables);
+DECLARE_ID_CLASS(Music_id, Music, music);
+DECLARE_ID_CLASS(Int_id, int, intid);
+DECLARE_ID_CLASS(Score_id, Score, score);
+DECLARE_ID_CLASS(Request_id, Request, request);
+DECLARE_ID_CLASS(Paper_def_id,Paper_def, paperdef);
+DECLARE_ID_CLASS(Midi_def_id,Midi_def, mididef);
+#endif // IDENTIFIER_