forked from rism-digital/verovio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathending.cpp
108 lines (89 loc) · 2.66 KB
/
ending.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/////////////////////////////////////////////////////////////////////////////
// Name: ending.cpp
// Author: Laurent Pugin
// Created: 14/07/2016
// Copyright (c) Authors and others. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
#include "ending.h"
//----------------------------------------------------------------------------
#include <cassert>
//----------------------------------------------------------------------------
#include "editorial.h"
#include "functor.h"
#include "measure.h"
#include "scoredef.h"
#include "section.h"
#include "system.h"
#include "vrv.h"
namespace vrv {
//----------------------------------------------------------------------------
// Ending
//----------------------------------------------------------------------------
static const ClassRegistrar<Ending> s_factory("ending", ENDING);
Ending::Ending()
: SystemElement(ENDING, "ending-")
, SystemMilestoneInterface()
, AttLabelled()
, AttLineRend()
, AttLineRendBase()
, AttNNumberLike()
{
this->RegisterAttClass(ATT_LABELLED);
this->RegisterAttClass(ATT_LINEREND);
this->RegisterAttClass(ATT_LINERENDBASE);
this->RegisterAttClass(ATT_NINTEGER);
this->Reset();
}
Ending::~Ending() {}
void Ending::Reset()
{
SystemElement::Reset();
SystemMilestoneInterface::Reset();
this->ResetLabelled();
this->ResetLineRend();
this->ResetLineRendBase();
this->ResetNNumberLike();
}
bool Ending::IsSupportedChild(Object *child)
{
if (child->Is(MEASURE)) {
assert(dynamic_cast<Measure *>(child));
}
else if (child->Is(SCOREDEF)) {
assert(dynamic_cast<ScoreDef *>(child));
}
else if (child->IsSystemElement()) {
assert(dynamic_cast<SystemElement *>(child));
// here we are actually allowing ending within ending, which is wrong
if (child->Is(ENDING)) {
return false;
}
}
else if (child->IsEditorialElement()) {
assert(dynamic_cast<EditorialElement *>(child));
}
else {
return false;
}
return true;
}
//----------------------------------------------------------------------------
// Ending functor methods
//----------------------------------------------------------------------------
FunctorCode Ending::Accept(Functor &functor)
{
return functor.VisitEnding(this);
}
FunctorCode Ending::Accept(ConstFunctor &functor) const
{
return functor.VisitEnding(this);
}
FunctorCode Ending::AcceptEnd(Functor &functor)
{
return functor.VisitEndingEnd(this);
}
FunctorCode Ending::AcceptEnd(ConstFunctor &functor) const
{
return functor.VisitEndingEnd(this);
}
} // namespace vrv