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