X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fidentifier.hh;h=002b935202b0ff1306f340c5c890368c610acaef;hb=beb54099cf241daac01cc026dad15211bf19c618;hp=85a398ae0eb2bc8c9352f93653c76e8814722856;hpb=c844072722a39a5fcd20372b0497d9130bd41dd7;p=lilypond.git diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index 85a398ae0e..002b935202 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -1,7 +1,7 @@ /* identifier.hh -- part of GNU LilyPond - (c) 1996,97 Han-Wen Nienhuys + (c) 1996--2000 Han-Wen Nienhuys */ #ifndef IDENTIFIER_HH @@ -12,13 +12,31 @@ #include "input.hh" #include "virtual-methods.hh" -#define IDACCESSOR(Class, accessor)\ -virtual Class * accessor () const { error (#Class + String ("_identifier")); return 0; } -/** - A declarable data structure in mudela. +#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_; @@ -30,56 +48,51 @@ struct Identifier : public Input { void print() const; - DECLARE_MY_RUNTIME_TYPEINFO; + 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(String,string) - IDACCESSOR(Request, request) - IDACCESSOR(Score, score) - IDACCESSOR(int, intid) - IDACCESSOR(Duration, duration) - VIRTUAL_COPY_CONS (Identifier, Identifier); + 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, accessor) \ +#define DECLARE_ID_CLASS(Class) \ struct Class ## _identifier : Identifier {\ Class *data_p_; \ - 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;\ + 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; \ }\ -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); +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