]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/identifier.hh
release: 0.1.63
[lilypond.git] / lily / include / identifier.hh
index b7365e5650cac124374da87652fa60d795208f0f..85a398ae0eb2bc8c9352f93653c76e8814722856 100644 (file)
@@ -12,8 +12,8 @@
 #include "input.hh"
 #include "virtual-methods.hh"
 
-#define IDACCESSOR( Input_staff, staff)\
-virtual Input_staff * staff () { error (#Input_staff); return 0; }
+#define IDACCESSOR(Class, accessor)\
+virtual Class * accessor () const { error (#Class  + String ("_identifier")); return 0; }
 
 /**
    A declarable data structure in mudela. 
@@ -24,53 +24,62 @@ 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;
   DECLARE_MY_RUNTIME_TYPEINFO;
-  void error (String);
+  void error (String) const;
+  String str () const;
   IDACCESSOR(Translator, 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)
+  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(String,string)
+  IDACCESSOR(Request, request)
+  IDACCESSOR(Score, score)
+  IDACCESSOR(int, intid)
+  IDACCESSOR(Duration, duration)
+  VIRTUAL_COPY_CONS (Identifier, Identifier);
 
-    protected:
-  virtual void do_print() const=0;
-private:
-  Identifier (Identifier const&);
+protected:
+  virtual void do_print () const;
+  virtual String do_str () const;
 };
 
-#define DECLARE_ID_CLASS(Idclass, Class, accessor)     \
-struct Idclass : Identifier {\
+#define DECLARE_ID_CLASS(Class, accessor)      \
+struct Class ## _identifier : Identifier {\
                             Class *data_p_;                 \
-                            DECLARE_MY_RUNTIME_TYPEINFO;                           \
-                            Idclass (Class*st, int code);\
-                            virtual Class* accessor ();\
-                            ~Idclass();\
-                            virtual void do_print() const; \
+                            DECLARE_MY_RUNTIME_TYPEINFO; \
+                            Class ## _identifier (Class ## _identifier const&);\
+                            Class ## _identifier (Class*st, int code);\
+                            VIRTUAL_COPY_CONS (Class ## _identifier, Identifier);\
+                            virtual Class* accessor () const;\
+                            ~Class ## _identifier();\
+                            virtual void do_print () const; \
+                            virtual String do_str () const; \
 }\
 
 
-DECLARE_ID_CLASS(Translator_id, Translator, 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_
+DECLARE_ID_CLASS(Translator, translator);
+DECLARE_ID_CLASS(Duration, duration);
+DECLARE_ID_CLASS(Real, real);
+DECLARE_ID_CLASS(String, string);
+DECLARE_ID_CLASS(General_script_def, script);
+DECLARE_ID_CLASS(Lookup, lookup);
+DECLARE_ID_CLASS(Symtables, symtables);
+DECLARE_ID_CLASS(Music, music);
+DECLARE_ID_CLASS(int, intid);
+DECLARE_ID_CLASS(Score, score);
+DECLARE_ID_CLASS(Request, request);
+DECLARE_ID_CLASS(Paper_def, paperdef);
+DECLARE_ID_CLASS(Midi_def, mididef);
+
+#endif // IDENTIFIER_HH
+