]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/identifier.hh
release: 0.0.78
[lilypond.git] / lily / include / identifier.hh
1 /*
2   identifier.hh -- part of GNU LilyPond
3
4   (c) 1996,97 Han-Wen Nienhuys
5 */
6
7 #ifndef IDENTIFIER_HH
8 #define IDENTIFIER_HH
9
10 #include "lily-proto.hh"
11 #include "string.hh"
12 #include "input.hh"
13 #include "virtual-methods.hh"
14
15 /* boolean argument to accesor is copy_b..*/
16 #define IDACCESSOR( Input_staff, staff)\
17     virtual Input_staff * staff(bool) { error(#Input_staff); return 0; }
18
19
20 struct Identifier : public Input {
21     void *data;
22     String name_str_;
23     bool init_b_;
24     bool accessed_b_;
25     int token_code_i_;
26     
27     Identifier(String n, int code) ;
28     virtual ~Identifier() ;
29
30     void print()const;
31     DECLARE_MY_RUNTIME_TYPEINFO;
32     void error(String);
33     IDACCESSOR(Input_translator, input_translator)
34     IDACCESSOR(Music, music)
35     IDACCESSOR(General_script_def, script)
36     IDACCESSOR(Symtables, symtables)
37     IDACCESSOR(Midi_def, mididef)
38     IDACCESSOR(Paper_def, paperdef)
39     IDACCESSOR(Lookup,lookup)
40     IDACCESSOR(Real,real)
41     IDACCESSOR(Request, request)
42     IDACCESSOR(Score, score)
43     IDACCESSOR(int, intid)
44
45 protected:
46     virtual void do_print()const=0;
47 private:
48     Identifier(Identifier const&);
49 };
50
51 #define declare_id_class(Idclass, Class, accessor)      \
52 struct Idclass : Identifier {\
53         DECLARE_MY_RUNTIME_TYPEINFO;                        \
54         Idclass(String s, Class*st, int code);\
55         virtual Class* accessor(bool copy);\
56         ~Idclass();\
57         virtual void do_print()const; \
58 }\
59
60
61 declare_id_class(Input_translator_id, Input_translator, input_translator);
62 declare_id_class(Real_id, Real, real);
63 declare_id_class(Script_id, General_script_def, script);
64 declare_id_class(Lookup_id, Lookup, lookup);
65 declare_id_class(Symtables_id, Symtables, symtables);
66 declare_id_class(Music_id, Music, music);
67 declare_id_class(Int_id, int, intid);
68 declare_id_class(Score_id, Score, score);
69 declare_id_class(Request_id, Request, request);
70 declare_id_class(Paper_def_id,Paper_def, paperdef);
71 declare_id_class(Midi_def_id,Midi_def, mididef);
72 #endif // IDENTIFIER_