]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/identifier.hh
release: 0.1.63
[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(Class, accessor)\
16 virtual Class * accessor () const { error (#Class  + String ("_identifier")); 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   Identifier (Identifier const&);    
28   Identifier (int code) ;
29   virtual ~Identifier() ;
30
31
32   void print() const;
33   DECLARE_MY_RUNTIME_TYPEINFO;
34   void error (String) const;
35   String str () const;
36   IDACCESSOR(Translator, translator)
37   IDACCESSOR(Music, music)
38   IDACCESSOR(General_script_def, script)
39   IDACCESSOR(Symtables, symtables)
40   IDACCESSOR(Midi_def, mididef)
41   IDACCESSOR(Paper_def, paperdef)
42   IDACCESSOR(Lookup,lookup)
43   IDACCESSOR(Real,real)
44   IDACCESSOR(String,string)
45   IDACCESSOR(Request, request)
46   IDACCESSOR(Score, score)
47   IDACCESSOR(int, intid)
48   IDACCESSOR(Duration, duration)
49   VIRTUAL_COPY_CONS (Identifier, Identifier);
50
51 protected:
52   virtual void do_print () const;
53   virtual String do_str () const;
54 };
55
56 #define DECLARE_ID_CLASS(Class, accessor)       \
57 struct Class ## _identifier : Identifier {\
58                              Class *data_p_;                 \
59                              DECLARE_MY_RUNTIME_TYPEINFO; \
60                              Class ## _identifier (Class ## _identifier const&);\
61                              Class ## _identifier (Class*st, int code);\
62                              VIRTUAL_COPY_CONS (Class ## _identifier, Identifier);\
63                              virtual Class* accessor () const;\
64                              ~Class ## _identifier();\
65                              virtual void do_print () const; \
66                              virtual String do_str () const; \
67 }\
68
69
70 DECLARE_ID_CLASS(Translator, translator);
71 DECLARE_ID_CLASS(Duration, duration);
72 DECLARE_ID_CLASS(Real, real);
73 DECLARE_ID_CLASS(String, string);
74 DECLARE_ID_CLASS(General_script_def, script);
75 DECLARE_ID_CLASS(Lookup, lookup);
76 DECLARE_ID_CLASS(Symtables, symtables);
77 DECLARE_ID_CLASS(Music, music);
78 DECLARE_ID_CLASS(int, intid);
79 DECLARE_ID_CLASS(Score, score);
80 DECLARE_ID_CLASS(Request, request);
81 DECLARE_ID_CLASS(Paper_def, paperdef);
82 DECLARE_ID_CLASS(Midi_def, mididef);
83
84 #endif // IDENTIFIER_HH
85