LibMusicXML 3.18
msrRepeats_MUT_DEP.h
1/*
2 This file is to be included only by msrMutualDependencies.h,
3 to satisfy declarations mutual dependencies.
4*/
5
6//______________________________________________________________________________
7/* JMI
8class msrRepeatElement : public msrElement
9{
10 public:
11
12 // creation from MusicXML
13 // ------------------------------------------------------
14
15 static SMARTP<msrRepeatElement> create (
16 int inputLineNumber,
17 S_msrRepeat repeatUpLink);
18
19 protected:
20
21 // constructors/destructor
22 // ------------------------------------------------------
23
24 msrRepeatElement (
25 int inputLineNumber,
26 S_msrRepeat repeatUpLink);
27
28 virtual ~msrRepeatElement ();
29
30 public:
31
32 // set and get
33 // ------------------------------------------------------
34
35 // upLinks
36 S_msrRepeat getRepeatElementRepeatUpLink () const
37 { return fRepeatElementRepeatUpLink; }
38
39 // elements
40 const list<S_msrVoiceElement>&
41 getRepeatElementElementsList ()
42 { return fRepeatElementElementsList; }
43
44 public:
45
46 // public services
47 // ------------------------------------------------------
48
49 void appendSegmentToRepeatElementsList (
50 int inputLineNumber,
51 S_msrSegment segment,
52 string context);
53
54 void appendRepeatToRepeatElementsList (
55 int inputLineNumber,
56 S_msrRepeat repeat,
57 string context);
58
59 void appendMeasuresRepeatToRepeatElementsList (
60 int inputLineNumber,
61 S_msrMeasuresRepeat measuresRepeat,
62 string context);
63
64 void appendRestMeasuresToRepeatElementsList (
65 int inputLineNumber,
66 S_msrMeasuresRepeat measuresRepeat,
67 string context);
68
69 S_msrNote fetchRepeatElementFirstNonGraceNote () const;
70
71 void collectRepeatElementMeasuresIntoFlatList (
72 int inputLineNumber);
73
74 private:
75
76 // private services
77 // ------------------------------------------------------
78
79 void appendVoiceElementToRepeatElementsList ( // JMI
80 int inputLineNumber,
81 S_msrVoiceElement voiceElement,
82 string context);
83
84 public:
85
86 // visitors
87 // ------------------------------------------------------
88
89 virtual void acceptIn (basevisitor* v);
90 virtual void acceptOut (basevisitor* v);
91
92 virtual void browseData (basevisitor* v);
93
94 public:
95
96 // print
97 // ------------------------------------------------------
98
99 string asString () const;
100
101 virtual void print (ostream& os) const;
102
103 virtual void shortPrint (ostream& os) const;
104
105 private:
106
107 // fields
108 // ------------------------------------------------------
109
110 // upLinks
111 S_msrRepeat fRepeatElementRepeatUpLink;
112
113 // elements list
114 list<S_msrVoiceElement>
115 fRepeatElementElementsList;
116};
117typedef SMARTP<msrRepeatElement> S_msrRepeatElement;
118EXP ostream& operator<< (ostream& os, const S_msrRepeatElement& elt);
119*/
120
121//______________________________________________________________________________
122class msrRepeatCommonPart : public msrElement
123{
124 public:
125
126 // creation from MusicXML
127 // ------------------------------------------------------
128
129 static SMARTP<msrRepeatCommonPart> create (
130 int inputLineNumber,
131 S_msrRepeat repeatUpLink);
132
133 protected:
134
135 // constructors/destructor
136 // ------------------------------------------------------
137
139 int inputLineNumber,
140 S_msrRepeat repeatUpLink);
141
142 virtual ~msrRepeatCommonPart ();
143
144 public:
145
146 // set and get
147 // ------------------------------------------------------
148
149 // upLinks
150 S_msrRepeat getRepeatCommonPartRepeatUpLink () const
151 { return fRepeatCommonPartRepeatUpLink; }
152
153 // elements
154 const list<S_msrVoiceElement>&
155 getRepeatCommonPartElementsList ()
156 { return fRepeatCommonPartElementsList; }
157
158 public:
159
160 // services
161 // ------------------------------------------------------
162
163 void appendVoiceElementToRepeatCommonPart (
164 int inputLineNumber,
165 S_msrVoiceElement voiceElement,
166 string context);
167
168 void appendSegmentToRepeatCommonPart (
169 int inputLineNumber,
170 S_msrSegment segment,
171 string context);
172
173 void appendRepeatToRepeatCommonPart (
174 int inputLineNumber,
175 S_msrRepeat repeat,
176 string context);
177
178 void appendMeasuresRepeatToRepeatCommonPart (
179 int inputLineNumber,
180 S_msrMeasuresRepeat measuresRepeat,
181 string context);
182
183 void appendRestMeasuresToRepeatCommonPart (
184 int inputLineNumber,
185 S_msrRestMeasures restMeasures,
186 string context);
187
188 S_msrNote fetchRepeatCommonPartFirstNonGraceNote () const;
189
190 void collectRepeatCommonPartMeasuresIntoFlatList (
191 int inputLineNumber);
192
193 public:
194
195 // visitors
196 // ------------------------------------------------------
197
198 virtual void acceptIn (basevisitor* v);
199 virtual void acceptOut (basevisitor* v);
200
201 virtual void browseData (basevisitor* v);
202
203 public:
204
205 // print
206 // ------------------------------------------------------
207
208 string asString () const;
209
210 virtual void print (ostream& os) const;
211
212 virtual void shortPrint (ostream& os) const;
213
214 private:
215
216 // fields
217 // ------------------------------------------------------
218
219 // upLinks
220 S_msrRepeat fRepeatCommonPartRepeatUpLink;
221
222 // elements list
223 list<S_msrVoiceElement>
224 fRepeatCommonPartElementsList;
225};
226typedef SMARTP<msrRepeatCommonPart> S_msrRepeatCommonPart;
227EXP ostream& operator<< (ostream& os, const S_msrRepeatCommonPart& elt);
228
229//______________________________________________________________________________
230class msrRepeatEnding : public msrElement
231{
232 public:
233
234 // data types
235 // ------------------------------------------------------
236
237 enum msrRepeatEndingKind {
238 kHookedEnding,
239 kHooklessEnding};
240
241 static string repeatEndingKindAsString (
242 msrRepeatEndingKind repeatEndingKind);
243
244 // creation from MusicXML
245 // ------------------------------------------------------
246
247 static SMARTP<msrRepeatEnding> create (
248 int inputLineNumber,
249 string repeatEndingNumber, // may be "1, 2"
250 msrRepeatEndingKind repeatEndingKind,
251 S_msrRepeat repeatUpLink);
252
253 /* JMI
254 SMARTP<msrRepeatEnding> createRepeatEndingNewbornClone (
255 S_msrRepeat containingRepeat);
256 */
257
258 protected:
259
260 // constructors/destructor
261 // ------------------------------------------------------
262
264 int inputLineNumber,
265 string repeatEndingNumber, // may be "1, 2"
266 msrRepeatEndingKind repeatEndingKind,
267 S_msrRepeat repeatUpLink);
268
269 virtual ~msrRepeatEnding ();
270
271 public:
272
273 // set and get
274 // ------------------------------------------------------
275
276 // upLinks
277 S_msrRepeat getRepeatEndingRepeatUpLink () const
278 { return fRepeatEndingRepeatUpLink; }
279
280 // numbers
281 string getRepeatEndingNumber () const
282 { return fRepeatEndingNumber; }
283
284 void setRepeatEndingNumber (int repeatEndingNumber)
285 { fRepeatEndingNumber = repeatEndingNumber; }
286
287 void setRepeatEndingInternalNumber (
288 int repeatEndingInternalNumber)
289 {
290 fRepeatEndingInternalNumber =
291 repeatEndingInternalNumber;
292 }
293
294 int getRepeatEndingInternalNumber () const
295 { return fRepeatEndingInternalNumber; }
296
297 // kind
298 msrRepeatEndingKind getRepeatEndingKind () const
299 { return fRepeatEndingKind; }
300
301 // elements
302 const list<S_msrVoiceElement>&
303 getRepeatEndingElementsList ()
304 { return fRepeatEndingElementsList; }
305
306 // services
307 // ------------------------------------------------------
308
309 void appendVoiceElementToRepeatEnding ( // JMI
310 int inputLineNumber,
311 S_msrVoiceElement voiceElement,
312 string context);
313
314 void appendSegmentToRepeatEnding (
315 int inputLineNumber,
316 S_msrSegment segment,
317 string context);
318
319 void appendRepeatToRepeatEnding (
320 int inputLineNumber,
321 S_msrRepeat repeat,
322 string context);
323
324 void appendMeasuresRepeatToRepeatEnding (
325 int inputLineNumber,
326 S_msrMeasuresRepeat measuresRepeat,
327 string context);
328
329 void appendRestMeasuresToRepeatEnding (
330 int inputLineNumber,
331 S_msrRestMeasures restMeasures,
332 string context);
333
334 void collectRepeatEndingMeasuresIntoFlatList (
335 int inputLineNumber);
336
337 public:
338
339 // visitors
340 // ------------------------------------------------------
341
342 virtual void acceptIn (basevisitor* v);
343 virtual void acceptOut (basevisitor* v);
344
345 virtual void browseData (basevisitor* v);
346
347 public:
348
349 // print
350 // ------------------------------------------------------
351
352 string asString () const;
353
354 virtual void print (ostream& os) const;
355
356 virtual void shortPrint (ostream& os) const;
357
358 private:
359
360 // fields
361 // ------------------------------------------------------
362
363 // upLinks
364 S_msrRepeat fRepeatEndingRepeatUpLink;
365
366 // numbers
367 string fRepeatEndingNumber; // may be "1, 2"
368 int fRepeatEndingInternalNumber; // internally assigned
369
370 // kind
371 msrRepeatEndingKind fRepeatEndingKind;
372
373 // elements list
374 list<S_msrVoiceElement>
375 fRepeatEndingElementsList;
376};
377typedef SMARTP<msrRepeatEnding> S_msrRepeatEnding;
378EXP ostream& operator<< (ostream& os, const S_msrRepeatEnding& elt);
379
380//______________________________________________________________________________
381class msrRepeat : public msrVoiceElement
382{
383 public:
384
385 // data types
386 // ------------------------------------------------------
387
388 enum msrRepeatExplicitStartKind {
389 kRepeatExplicitStartNo,
390 kRepeatExplicitStartYes };
391
392 static string repeatExplicitStartKindAsString (
393 msrRepeatExplicitStartKind repeatExplicitStartKind);
394
395 enum msrRepeatBuildPhaseKind {
396 kRepeatBuildPhaseJustCreated,
397 kRepeatBuildPhaseInCommonPart,
398 kRepeatBuildPhaseInEndings,
399 kRepeatBuildPhaseCompleted};
400
401 static string repeatBuildPhaseKindAsString (
402 msrRepeatBuildPhaseKind repeatBuildPhaseKind);
403
404 // creation from MusicXML
405 // ------------------------------------------------------
406
407 static SMARTP<msrRepeat> create (
408 int inputLineNumber,
409 int repeatTimes,
410 S_msrVoice voiceUpLink);
411
412 SMARTP<msrRepeat> createRepeatNewbornClone (
413 S_msrVoice containingVoice);
414
415 protected:
416
417 // constructors/destructor
418 // ------------------------------------------------------
419
420 msrRepeat (
421 int inputLineNumber,
422 int repeatTimes,
423 S_msrVoice voiceUpLink);
424
425 virtual ~msrRepeat ();
426
427 public:
428
429 // set and get
430 // ------------------------------------------------------
431
432 // upLinks
433 S_msrVoice getRepeatVoiceUpLink () const
434 { return fRepeatVoiceUpLink; }
435 // times
436 int getRepeatTimes () const
437 { return fRepeatTimes; }
438
439 void setRepeatTimes (int repeatTimes) // JMI
440 { fRepeatTimes = repeatTimes; }
441
442 // implicit start?
443 void setRepeatExplicitStartKind (
444 msrRepeatExplicitStartKind repeatExplicitStartKind)
445 {
446 fRepeatExplicitStartKind =
447 repeatExplicitStartKind;
448 }
449
450 msrRepeatExplicitStartKind
451 getRepeatExplicitStartKind () const
452 { return fRepeatExplicitStartKind; }
453
454 // common part
455 void setRepeatCommonPart (
456 S_msrRepeatCommonPart repeatCommonPart);
457
458 S_msrRepeatCommonPart getRepeatCommonPart () const
459 { return fRepeatCommonPart; }
460
461 // endings
462 const vector<S_msrRepeatEnding>&
463 getRepeatEndings () const
464 { return fRepeatEndings; }
465
466 public:
467
468 // public services
469 // ------------------------------------------------------
470
471 void addRepeatEndingToRepeat (
472 int inputLineNumber,
473 S_msrRepeatEnding repeatEnding);
474
475 void appendSegmentToRepeat (
476 int inputLineNumber,
477 S_msrSegment segment,
478 string context);
479
480 void appendRepeatToRepeat (
481 int inputLineNumber,
482 S_msrRepeat repeat,
483 string context);
484
485 void appendMeasuresRepeatToRepeat (
486 int inputLineNumber,
487 S_msrMeasuresRepeat measuresRepeat,
488 string context);
489
490 void appendRestMeasuresToRepeat (
491 int inputLineNumber,
492 S_msrRestMeasures restMeasures,
493 string context);
494
495 S_msrNote fetchRepeatFirstNonGraceNote () const;
496
497 void collectRepeatMeasuresIntoFlatList (
498 int inputLineNumber);
499
500 public:
501
502 // visitors
503 // ------------------------------------------------------
504
505 virtual void acceptIn (basevisitor* v);
506 virtual void acceptOut (basevisitor* v);
507
508 virtual void browseData (basevisitor* v);
509
510 public:
511
512 // print
513 // ------------------------------------------------------
514
515 string asShortString () const;
516 string asString () const;
517
518 void displayRepeat (
519 int inputLineNumber,
520 string context);
521
522 virtual void print (ostream& os) const;
523
524 virtual void shortPrint (ostream& os) const;
525
526 private:
527
528 // fields
529 // ------------------------------------------------------
530
531 // upLinks
532 S_msrVoice fRepeatVoiceUpLink;
533
534 // number of repetitions
535 int fRepeatTimes;
536
537 // explicit start?
538 msrRepeatExplicitStartKind
539 fRepeatExplicitStartKind;
540
541 // common part
542 S_msrRepeatCommonPart fRepeatCommonPart;
543
544 // repeat endings
545 vector<S_msrRepeatEnding>
546 fRepeatEndings;
547 int fRepeatEndingsInternalCounter;
548
549 public:
550
551 // public work services
552 // ------------------------------------------------------
553
554 // repeat build phase
555 void setCurrentRepeatBuildPhaseKind (
556 msrRepeatBuildPhaseKind repeatBuildPhaseKind)
557 {
558 fCurrentRepeatBuildPhaseKind =
559 repeatBuildPhaseKind;
560 }
561
562 msrRepeatBuildPhaseKind
563 getCurrentRepeatBuildPhaseKind () const
564 { return fCurrentRepeatBuildPhaseKind; }
565
566 private:
567
568 // private work services
569 // ------------------------------------------------------
570
571 private:
572
573 // work fields
574 // ------------------------------------------------------
575
576 // repeat build phase, used when building the repeat
577 msrRepeatBuildPhaseKind
578 fCurrentRepeatBuildPhaseKind;
579};
580typedef SMARTP<msrRepeat> S_msrRepeat;
581EXP ostream& operator<< (ostream& os, const S_msrRepeat& elt);
582
583//________________________________________________________________________
584struct msrRepeatDescr : public smartable
585{
586 public:
587
588 // creation
589 // ------------------------------------------------------
590
591 static SMARTP<msrRepeatDescr> create (
592 int repeatDescrStartInputLineNumber,
593 S_msrRepeat repeatDescrRepeat);
594
595 protected:
596
597 // constructors/destructor
598 // ------------------------------------------------------
599
601 int repeatDescrStartInputLineNumber,
602 S_msrRepeat fRepeatDescrRepeat);
603
604 virtual ~msrRepeatDescr ();
605
606 public:
607
608 // set and get
609 // ------------------------------------------------------
610
611 S_msrRepeat getRepeatDescrRepeat () const
612 { return fRepeatDescrRepeat; }
613
614 void setRepeatDescrStartInputLineNumber (
615 int inputLineNumber)
616 {
617 fRepeatDescrStartInputLineNumber =
618 inputLineNumber;
619 }
620
621 int getRepeatDescrStartInputLineNumber () const
622 {
623 return
624 fRepeatDescrStartInputLineNumber;
625 }
626
627 // services
628 // ------------------------------------------------------
629
630 string repeatDescrAsString () const;
631
632 // print
633 // ------------------------------------------------------
634
635 virtual void print (ostream& os) const;
636
637 private:
638
639 // fields
640 // ------------------------------------------------------
641
642 // the repeat
643 S_msrRepeat fRepeatDescrRepeat;
644
645 // its start input line number
646 int fRepeatDescrStartInputLineNumber;
647};
648typedef SMARTP<msrRepeatDescr> S_msrRepeatDescr;
649EXP ostream& operator<< (ostream& os, const S_msrRepeatDescr& elt);
650
Definition: msrRepeats_MUT_DEP.h:123
Definition: msrRepeats_MUT_DEP.h:231
Definition: msrRepeats_MUT_DEP.h:382
Definition: msrRepeats_MUT_DEP.h:585