]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/request.hh
release: 1.0.15
[lilypond.git] / lily / include / request.hh
1 /*
2   request.hh -- declare Request baseclasses.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef REQUEST_HH
10 #define REQUEST_HH
11
12
13 #include "string.hh"
14 #include "moment.hh"
15 #include "virtual-methods.hh"
16 #include "input.hh"
17 #include "music.hh"
18 #include "direction.hh"
19
20 #define DEFAULTACCESSOR(T)  virtual T *access_ ## T () { return 0; }
21
22
23 /**
24    An atom of musical information .
25  Hungarian postfix: req
26  @see lilygut manpage
27  */
28 class Request : public Music {
29
30 public:
31     
32   virtual ~Request(){}
33
34   DECLARE_MY_RUNTIME_TYPEINFO;
35   VIRTUAL_COPY_CONS(Request,Music);
36     
37   /*  accessors for children
38       maybe checkout RTTI
39   */
40
41   DEFAULTACCESSOR(Barcheck_req)
42   DEFAULTACCESSOR(Script_req)
43   DEFAULTACCESSOR(Span_req)
44   DEFAULTACCESSOR(Spacing_req)
45   DEFAULTACCESSOR(Musical_req)
46   DEFAULTACCESSOR(Command_req)
47     
48   bool equal_b (Request*) const;
49 protected:
50   virtual bool do_equal_b (Request*) const;
51   virtual void do_print() const;
52 };
53
54
55 #define REQUESTMETHODS(T)       \
56 virtual T * access_ ## T() { return this;}\
57 DECLARE_MY_RUNTIME_TYPEINFO;\
58 VIRTUAL_COPY_CONS(T, Request);\
59 virtual void do_print() const
60
61
62
63 /** Put a script above or below this ``note'' or bar. eg upbow, downbow. Why
64   a request? These symbols may conflict with slurs and brackets, so
65   this also a request */
66
67 class Script_req  : public virtual Request { 
68 public:
69   Direction dir_;
70   General_script_def *scriptdef_p_;
71   
72   bool do_equal_b (Request*) const;
73
74   Script_req();
75   REQUESTMETHODS(Script_req);
76   ~Script_req();
77   Script_req (Script_req const&);
78 };
79
80
81 /**
82   Requests to start or stop something.
83  This type of request typically results in the creation of a #Spanner#
84 */
85 class Span_req  : public virtual Request  {
86 public:
87   /// should the spanner start or stop, or is it unwanted?
88   enum Spantype {
89     NOSPAN, START, STOP
90   } spantype;
91   bool do_equal_b (Request*) const;
92   REQUESTMETHODS(Span_req);
93
94   Span_req();
95 };
96
97
98 #endif