]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/identifier.hh
release: 1.3.33
[lilypond.git] / lily / include / identifier.hh
1 /*
2   identifier.hh -- part of GNU LilyPond
3
4   (c) 1996--2000 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
16 #define DECLARE_TYPE_NAME(Class)
17
18 class Notename_table_identifier;
19 class Translator_group_identifier;
20 class Music_identifier;
21 class Articulation_req_identifier;
22 class Midi_def_identifier;
23 class Paper_def_identifier;
24 class Real_identifier;
25 class int_identifier;
26 class String_identifier;
27 class Request_identifier;
28 class Score_identifier;
29 class Duration_identifier;
30
31
32
33 #define IDACCESSOR(Class)\
34 virtual Class *  access_content_ ## Class (bool) const { error (#Class  + String ("_identifier")); return 0; }\
35
36
37 /**
38    A declarable data structure in mudela.
39
40    TODO: use SMOBS for the union type, and junk all derived classes.
41    */
42 struct Identifier : public Input {
43   bool init_b_;
44   bool accessed_b_;
45   int token_code_i_;
46   Identifier (Identifier const&);    
47   Identifier (int code) ;
48   virtual ~Identifier() ;
49
50
51   void print() const;
52   
53   void error (String) const;
54   String str () const;
55   IDACCESSOR(Translator_group)
56   IDACCESSOR(Notename_table)
57   IDACCESSOR(Music)
58   IDACCESSOR(Midi_def)
59   IDACCESSOR(Paper_def)
60   IDACCESSOR(Real)
61   IDACCESSOR(String)
62   IDACCESSOR(Request)
63   IDACCESSOR(Score)
64   IDACCESSOR(int)
65   IDACCESSOR(Duration)
66   VIRTUAL_COPY_CONS(Identifier);
67
68 protected:
69   virtual void do_print () const;
70   virtual String do_str () const;
71 };
72
73 #define DECLARE_ID_CLASS(Class) \
74 struct Class ## _identifier : Identifier {\
75                              Class *data_p_;                 \
76                               \
77                              Class ## _identifier (Class ## _identifier const&);\
78                              Class ## _identifier (Class*st, int code);\
79                              VIRTUAL_COPY_CONS(Identifier);\
80                              virtual Class* access_content_ ## Class (bool copy_b) const;\
81                              ~Class ## _identifier();\
82                              virtual void do_print () const; \
83                              virtual String do_str () const; \
84 }\
85
86
87 DECLARE_ID_CLASS(Translator_group);
88 DECLARE_ID_CLASS(Duration);
89 DECLARE_ID_CLASS(Notename_table);
90 DECLARE_ID_CLASS(Real);
91 DECLARE_ID_CLASS(String);
92 DECLARE_ID_CLASS(General_script_def);
93 DECLARE_ID_CLASS(Music);
94 DECLARE_ID_CLASS(int);
95 DECLARE_ID_CLASS(Score);
96 DECLARE_ID_CLASS(Request);
97 DECLARE_ID_CLASS(Paper_def);
98 DECLARE_ID_CLASS(Midi_def);
99
100 #endif // IDENTIFIER_HH
101