]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/identifier.hh
patch::: 1.3.44.jcn1
[lilypond.git] / lily / include / identifier.hh
index 1aa7f7d0c4982c12ea3feec1387c78d2532a49ae..002b935202b0ff1306f340c5c890368c610acaef 100644 (file)
@@ -1,42 +1,98 @@
-
 /*
-  identifier.hh -- part of LilyPond
+  identifier.hh -- part of GNU LilyPond
 
-  (c) 1996,97 Han-Wen Nienhuys
+  (c) 1996--2000 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)        \
-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; \
+
+#include "lily-proto.hh"
+#include "string.hh"
+#include "input.hh"
+#include "virtual-methods.hh"
+
+
+#define DECLARE_TYPE_NAME(Class)
+
+class Translator_group_identifier;
+class Music_identifier;
+class Articulation_req_identifier;
+class Midi_def_identifier;
+class Paper_def_identifier;
+class Real_identifier;
+class int_identifier;
+class String_identifier;
+class Request_identifier;
+class Score_identifier;
+class Duration_identifier;
+
+
+
+#define IDACCESSOR(Class)\
+virtual Class *  access_content_ ## Class (bool) const { error (#Class  + String ("_identifier")); return 0; }\
+
+
+/**
+   A declarable data structure in mudela.
+
+   TODO: use SMOBS for the union type, and junk all derived classes.
+   */
+struct Identifier : public Input {
+  bool init_b_;
+  bool accessed_b_;
+  int token_code_i_;
+  Identifier (Identifier const&);    
+  Identifier (int code) ;
+  virtual ~Identifier() ;
+
+
+  void print() const;
+  
+  void error (String) const;
+  String str () const;
+  IDACCESSOR(Translator_group)
+  IDACCESSOR(Music)
+  IDACCESSOR(Midi_def)
+  IDACCESSOR(Paper_def)
+  IDACCESSOR(Real)
+  IDACCESSOR(String)
+  IDACCESSOR(Request)
+  IDACCESSOR(Score)
+  IDACCESSOR(int)
+  IDACCESSOR(Duration)
+  VIRTUAL_COPY_CONS(Identifier);
+
+protected:
+  virtual void do_print () const;
+  virtual String do_str () const;
+};
+
+#define DECLARE_ID_CLASS(Class)        \
+struct Class ## _identifier : Identifier {\
+                            Class *data_p_;                 \
+                             \
+                            Class ## _identifier (Class ## _identifier const&);\
+                            Class ## _identifier (Class*st, int code);\
+                            VIRTUAL_COPY_CONS(Identifier);\
+                            virtual Class* access_content_ ## Class (bool copy_b) const;\
+                            ~Class ## _identifier();\
+                            virtual void do_print () const; \
+                            virtual String do_str () 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);
+
+DECLARE_ID_CLASS(Translator_group);
+DECLARE_ID_CLASS(Duration);
+DECLARE_ID_CLASS(Real);
+DECLARE_ID_CLASS(String);
+DECLARE_ID_CLASS(General_script_def);
+DECLARE_ID_CLASS(Music);
+DECLARE_ID_CLASS(int);
+DECLARE_ID_CLASS(Score);
+DECLARE_ID_CLASS(Request);
+DECLARE_ID_CLASS(Paper_def);
+DECLARE_ID_CLASS(Midi_def);
 
 #endif // IDENTIFIER_HH