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