]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/identifier.hh
release: 1.3.60
[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 "lily-guile.hh"
12 #include "string.hh"
13 #include "input.hh"
14 #include "virtual-methods.hh"
15 #include "smobs.hh"
16
17
18 #define DECLARE_TYPE_NAME(Class)
19
20 class Translator_group_identifier;
21 class Music_identifier;
22 class Articulation_req_identifier;
23 class Midi_def_identifier;
24 class Paper_def_identifier;
25 class Real_identifier;
26 class int_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
44   DECLARE_SMOBS;
45   bool init_b_;
46   bool accessed_b_;
47   int token_code_i_;
48   Identifier (Identifier const&);    
49   Identifier (int code) ;
50   virtual ~Identifier() ;
51   
52
53   void print() const;
54   
55   void error (String) const;
56   String str () const;
57   IDACCESSOR(Translator_group)
58   IDACCESSOR(Music)
59   IDACCESSOR(Midi_def)
60   IDACCESSOR(Paper_def)
61   IDACCESSOR(Real)
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(Real);
90 DECLARE_ID_CLASS(General_script_def);
91 DECLARE_ID_CLASS(Music);
92 DECLARE_ID_CLASS(int);
93 DECLARE_ID_CLASS(Score);
94 DECLARE_ID_CLASS(Request);
95 DECLARE_ID_CLASS(Paper_def);
96 DECLARE_ID_CLASS(Midi_def);
97
98 Identifier * unsmob_identifier (SCM);
99 SCM smobify (Identifier*);
100
101 #endif // IDENTIFIER_HH
102