LibMusicXML  3.18
lpsrContexts.h
1 /*
2  MusicXML Library
3  Copyright (C) Grame 2006-2013
4 
5  This Source Code Form is subject to the terms of the Mozilla Public
6  License, v. 2.0. If a copy of the MPL was not distributed with this
7  file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10  research@grame.fr
11 */
12 
13 #ifndef ___lpsrContexts___
14 #define ___lpsrContexts___
15 
16 #include <iostream>
17 #include <string>
18 #include <list>
19 
20 #include "lpsrElements.h"
21 
22 #include "msr.h"
23 
24 
25 using namespace std;
26 
27 namespace MusicXML2
28 {
29 
30 //______________________________________________________________________________
31 class lpsrContext : public lpsrElement
32 {
33  public:
34 
35  // data types
36  // ------------------------------------------------------
37 
38  enum lpsrContextTypeKind {
39  kChordNames, kFiguredBass };
40 
41  static string contextTypeKindAsString (
42  lpsrContextTypeKind contextTypeKind);
43 
44  enum lpsrContextExistingKind {
45  kExistingContextYes, kExistingContextNo};
46 
47  static string contextExistingKindAsString (
48  lpsrContextExistingKind contextExistingKind);
49 
50  // creation from MusicXML
51  // ------------------------------------------------------
52 
53  static SMARTP<lpsrContext> create (
54  int inputLineNumber,
55  lpsrContextExistingKind contextExistingKind,
56  lpsrContextTypeKind contextTypeKind,
57  string contextName);
58 
59  protected:
60 
61  // constructors/destructor
62  // ------------------------------------------------------
63 
64  lpsrContext (
65  int inputLineNumber,
66  lpsrContextExistingKind contextExistingKind,
67  lpsrContextTypeKind contextTypeKind,
68  string contextName);
69 
70  virtual ~lpsrContext ();
71 
72  public:
73 
74  // set and get
75  // ------------------------------------------------------
76 
77  lpsrContextExistingKind
78  getContextExistingKind () const
79  { return fContextExistingKind; }
80 
81  lpsrContextTypeKind getContextTypeKind () const
82  { return fContextTypeKind; }
83 
84  string getContextName () const
85  { return fContextName; }
86 
87  // services
88  // ------------------------------------------------------
89 
90  public:
91 
92  // visitors
93  // ------------------------------------------------------
94 
95  virtual void acceptIn (basevisitor* v);
96  virtual void acceptOut (basevisitor* v);
97 
98  virtual void browseData (basevisitor* v);
99 
100  public:
101 
102  // print
103  // ------------------------------------------------------
104 
105  string getContextTypeKindAsString () const
106  {
107  return
108  contextTypeKindAsString (
109  fContextTypeKind);
110  }
111 
112  string getContextExistingKindAsString () const
113  {
114  return
115  contextExistingKindAsString (
116  fContextExistingKind);
117  }
118 
119  virtual void print (ostream& os) const;
120 
121  protected:
122 
123  // fields
124  // ------------------------------------------------------
125 
126  lpsrContextExistingKind
127  fContextExistingKind;
128  lpsrContextTypeKind fContextTypeKind;
129  string fContextName;
130 
131  list<S_msrElement> fContextElementsList;
132 };
134 EXP ostream& operator<< (ostream& os, const S_lpsrContext& elt);
135 
136 //______________________________________________________________________________
138 {
139  public:
140 
141  // creation from MusicXML
142  // ------------------------------------------------------
143 
144  static SMARTP<lpsrChordNamesContext> create (
145  int inputLineNumber,
146  lpsrContextExistingKind contextExistingKind,
147  string contextName,
148  S_msrVoice contextVoice);
149 
150  protected:
151 
152  // constructors/destructor
153  // ------------------------------------------------------
154 
156  int inputLineNumber,
157  lpsrContextExistingKind contextExistingKind,
158  string contextName,
159  S_msrVoice contextVoice);
160 
161  virtual ~lpsrChordNamesContext ();
162 
163  public:
164 
165  // set and get
166  // ------------------------------------------------------
167 
168  S_msrVoice getContextVoice () const
169  { return fContextVoice; }
170 
171  // services
172  // ------------------------------------------------------
173 
174  public:
175 
176  // visitors
177  // ------------------------------------------------------
178 
179  virtual void acceptIn (basevisitor* v);
180  virtual void acceptOut (basevisitor* v);
181 
182  virtual void browseData (basevisitor* v);
183 
184  public:
185 
186  // print
187  // ------------------------------------------------------
188 
189  virtual void print (ostream& os) const;
190 
191  private:
192 
193  // fields
194  // ------------------------------------------------------
195 
196  S_msrVoice fContextVoice;
197 };
199 EXP ostream& operator<< (ostream& os, const S_lpsrChordNamesContext& elt);
200 
201 //______________________________________________________________________________
203 {
204  public:
205 
206  // creation from MusicXML
207  // ------------------------------------------------------
208 
209  static SMARTP<lpsrFiguredBassContext> create (
210  int inputLineNumber,
211  lpsrContextExistingKind contextExistingKind,
212  string contextName,
213  S_msrStaff contextStaff);
214 
215  protected:
216 
217  // constructors/destructor
218  // ------------------------------------------------------
219 
221  int inputLineNumber,
222  lpsrContextExistingKind contextExistingKind,
223  string contextName,
224  S_msrStaff contextStaff);
225 
226  virtual ~lpsrFiguredBassContext ();
227 
228  public:
229 
230  // set and get
231  // ------------------------------------------------------
232 
233  S_msrStaff getContextStaff () const
234  { return fContextStaff; }
235 
236  // services
237  // ------------------------------------------------------
238 
239  public:
240 
241  // visitors
242  // ------------------------------------------------------
243 
244  virtual void acceptIn (basevisitor* v);
245  virtual void acceptOut (basevisitor* v);
246 
247  virtual void browseData (basevisitor* v);
248 
249  public:
250 
251  // print
252  // ------------------------------------------------------
253 
254  virtual void print (ostream& os) const;
255 
256  private:
257 
258  // fields
259  // ------------------------------------------------------
260 
261  S_msrStaff fContextStaff;
262 };
264 EXP ostream& operator<< (ostream& os, const S_lpsrFiguredBassContext& elt);
265 
266 
267 }
268 
269 
270 #endif
MusicXML2::lpsrElement
Definition: lpsrElements.h:24
MusicXML2::lpsrChordNamesContext
Definition: lpsrContexts.h:138
MusicXML2::lpsrContext
Definition: lpsrContexts.h:32
MusicXML2::SMARTP
the smart pointer implementation
Definition: smartpointer.h:58
MusicXML2::basevisitor
Definition: basevisitor.h:25
MusicXML2::lpsrFiguredBassContext
Definition: lpsrContexts.h:203