]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/identifier.hh
release: 0.1.11
[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 #define IDACCESSOR( Input_staff, staff)\
16     virtual Input_staff * staff () { error (#Input_staff); return 0; }
17
18 /**
19    A declarable data structure in mudela. 
20
21
22    */
23 struct Identifier : public Input {
24     bool init_b_;
25     bool accessed_b_;
26     int token_code_i_;
27     
28     Identifier (int code) ;
29     virtual ~Identifier() ;
30
31     void print() const;
32     DECLARE_MY_RUNTIME_TYPEINFO;
33     void error (String);
34     IDACCESSOR(Input_translator, input_translator)
35     IDACCESSOR(Music, music)
36     IDACCESSOR(General_script_def, script)
37     IDACCESSOR(Symtables, symtables)
38     IDACCESSOR(Midi_def, mididef)
39     IDACCESSOR(Paper_def, paperdef)
40     IDACCESSOR(Lookup,lookup)
41     IDACCESSOR(Real,real)
42     IDACCESSOR(Request, request)
43     IDACCESSOR(Score, score)
44     IDACCESSOR(int, intid)
45     IDACCESSOR(Duration, duration)
46
47 protected:
48     virtual void do_print() const=0;
49 private:
50     Identifier (Identifier const&);
51 };
52
53 #define DECLARE_ID_CLASS(Idclass, Class, accessor)      \
54 struct Idclass : Identifier {\
55         Class *data_p_;              \
56         DECLARE_MY_RUNTIME_TYPEINFO;                        \
57         Idclass (Class*st, int code);\
58         virtual Class* accessor ();\
59         ~Idclass();\
60         virtual void do_print() const; \
61 }\
62
63
64 DECLARE_ID_CLASS(Input_translator_id, Input_translator, input_translator);
65 DECLARE_ID_CLASS(Duration_id, Duration, duration);
66 DECLARE_ID_CLASS(Real_id, Real, real);
67 DECLARE_ID_CLASS(Script_id, General_script_def, script);
68 DECLARE_ID_CLASS(Lookup_id, Lookup, lookup);
69 DECLARE_ID_CLASS(Symtables_id, Symtables, symtables);
70 DECLARE_ID_CLASS(Music_id, Music, music);
71 DECLARE_ID_CLASS(Int_id, int, intid);
72 DECLARE_ID_CLASS(Score_id, Score, score);
73 DECLARE_ID_CLASS(Request_id, Request, request);
74 DECLARE_ID_CLASS(Paper_def_id,Paper_def, paperdef);
75 DECLARE_ID_CLASS(Midi_def_id,Midi_def, mididef);
76 #endif // IDENTIFIER_