]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/identifier.hh
release: 1.0.1
[lilypond.git] / lily / include / identifier.hh
1 /*
2   identifier.hh -- part of GNU LilyPond
3
4   (c) 1996--1998 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)\
16 virtual Class *  access_ ## Class (bool=true) 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)
37   IDACCESSOR(Music)
38   IDACCESSOR(General_script_def)
39   IDACCESSOR(Symtables)
40   IDACCESSOR(Midi_def)
41   IDACCESSOR(Paper_def)
42   IDACCESSOR(Lookup)
43   IDACCESSOR(Real)
44   IDACCESSOR(String)
45   IDACCESSOR(Request)
46   IDACCESSOR(Score)
47   IDACCESSOR(int)
48   IDACCESSOR(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) \
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* access_ ## Class (bool copy_b = true) const;\
64                              ~Class ## _identifier();\
65                              virtual void do_print () const; \
66                              virtual String do_str () const; \
67 }\
68
69
70 DECLARE_ID_CLASS(Translator);
71 DECLARE_ID_CLASS(Duration);
72 DECLARE_ID_CLASS(Real);
73 DECLARE_ID_CLASS(String);
74 DECLARE_ID_CLASS(General_script_def);
75 DECLARE_ID_CLASS(Lookup);
76 DECLARE_ID_CLASS(Symtables);
77 DECLARE_ID_CLASS(Music);
78 DECLARE_ID_CLASS(int);
79 DECLARE_ID_CLASS(Score);
80 DECLARE_ID_CLASS(Request);
81 DECLARE_ID_CLASS(Paper_def);
82 DECLARE_ID_CLASS(Midi_def);
83
84 #endif // IDENTIFIER_HH
85