forked from rism-digital/verovio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editorial.cpp
144 lines (121 loc) · 3.78 KB
/
editorial.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/////////////////////////////////////////////////////////////////////////////
// Name: editorial.cpp
// Author: Laurent Pugin
// Created: 2014
// Copyright (c) Authors and others. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
#include "editorial.h"
//----------------------------------------------------------------------------
#include <cassert>
//----------------------------------------------------------------------------
#include "artic.h"
#include "controlelement.h"
#include "fig.h"
#include "functor.h"
#include "layer.h"
#include "measure.h"
#include "scoredef.h"
#include "section.h"
#include "staff.h"
#include "symbol.h"
#include "system.h"
#include "text.h"
#include "textelement.h"
#include "vrv.h"
namespace vrv {
//----------------------------------------------------------------------------
// EditorialElement
//----------------------------------------------------------------------------
EditorialElement::EditorialElement()
: Object(EDITORIAL_ELEMENT, "ee-"), SystemMilestoneInterface(), AttLabelled(), AttTyped()
{
this->RegisterAttClass(ATT_LABELLED);
this->RegisterAttClass(ATT_TYPED);
this->Reset();
}
EditorialElement::EditorialElement(ClassId classId)
: Object(classId, "ee-"), SystemMilestoneInterface(), AttLabelled(), AttTyped()
{
this->RegisterAttClass(ATT_LABELLED);
this->RegisterAttClass(ATT_TYPED);
this->Reset();
}
EditorialElement::EditorialElement(ClassId classId, const std::string &classIdStr)
: Object(classId, classIdStr), SystemMilestoneInterface(), AttLabelled(), AttTyped()
{
this->RegisterAttClass(ATT_LABELLED);
this->RegisterAttClass(ATT_TYPED);
this->Reset();
}
void EditorialElement::Reset()
{
Object::Reset();
SystemMilestoneInterface::Reset();
this->ResetLabelled();
this->ResetTyped();
m_visibility = Visible;
}
EditorialElement::~EditorialElement() {}
bool EditorialElement::IsSupportedChild(Object *child)
{
if (child->IsEditorialElement()) {
assert(dynamic_cast<EditorialElement *>(child));
}
else if (child->IsSystemElement()) {
assert(dynamic_cast<SystemElement *>(child));
}
else if (child->IsControlElement()) {
assert(dynamic_cast<ControlElement *>(child));
}
else if (child->IsLayerElement()) {
assert(dynamic_cast<LayerElement *>(child));
}
else if (child->IsTextElement()) {
assert(dynamic_cast<TextElement *>(child));
}
else if (child->Is(LAYER)) {
assert(dynamic_cast<Layer *>(child));
}
else if (child->Is(MEASURE)) {
assert(dynamic_cast<Measure *>(child));
}
else if (child->Is(SCOREDEF)) {
assert(dynamic_cast<ScoreDef *>(child));
}
else if (child->Is(STAFF)) {
assert(dynamic_cast<Staff *>(child));
}
else if (child->Is(STAFFDEF)) {
assert(dynamic_cast<Staff *>(child));
}
else if (child->Is(STAFFGRP)) {
assert(dynamic_cast<Staff *>(child));
}
else if (child->Is(SYMBOL)) {
assert(dynamic_cast<Symbol *>(child));
}
else {
return false;
}
return true;
}
//----------------------------------------------------------------------------
// EditorialElement functor methods
//----------------------------------------------------------------------------
FunctorCode EditorialElement::Accept(Functor &functor)
{
return functor.VisitEditorialElement(this);
}
FunctorCode EditorialElement::Accept(ConstFunctor &functor) const
{
return functor.VisitEditorialElement(this);
}
FunctorCode EditorialElement::AcceptEnd(Functor &functor)
{
return functor.VisitEditorialElementEnd(this);
}
FunctorCode EditorialElement::AcceptEnd(ConstFunctor &functor) const
{
return functor.VisitEditorialElementEnd(this);
}
} // namespace vrv