]> git.donarmstrong.com Git - lilypond.git/blobdiff - hdr/identifier.hh
release: 0.0.15
[lilypond.git] / hdr / identifier.hh
index 9cb80386c0a51ae15bff1b52a8177012419499ee..3ac537f63e1b84914d7bd2bc7aa014964a60087e 100644 (file)
@@ -7,30 +7,28 @@
 
 #ifndef IDENTIFIER_HH
 #define IDENTIFIER_HH
-#include "proto.hh"
-#include "string.hh"
+#include "identparent.hh"
+#include "symtable.hh"
+#include "inputstaff.hh"
+#include "inputmusic.hh"
 
-struct Identifier
-{
-    void *data;
-    String name;
-    
-    Identifier(String n) ;
-    virtual ~Identifier();
-    virtual Staff * staff() { assert(false); }
-    virtual Voice * voice() { assert(false); }
-};
+#define make_id_class(Idclass, Class, accessor)        \
+struct Idclass : Identifier {\
+    Idclass(String s, Class*st):Identifier(s) { data = st; }\
+    virtual Class* accessor(bool copy=false) {\
+       if (copy)\
+           return new Class(* (Class*) data);\
+       else\
+           return (Class*) data;\
+    }\
+    ~Idclass() { delete accessor(); }\
+}\
 
-struct Staff_id : Identifier {
-    Staff_id(String s, Staff*st):Identifier(s) { data = st; }
-    virtual Staff* staff() { return (Staff*) data; }
-    ~Staff_id();
-};
+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);
 
-struct Voice_id : Identifier {
-    Voice_id(String s, Voice*st):Identifier(s) { data = st; }
-    virtual Voice * voice() { return (Voice*)data; }
-    ~Voice_id();
-};
 #endif // IDENTIFIER_HH