MUSX Document Model
Loading...
Searching...
No Matches
FieldPopulatorsOthers.h
1/*
2 * Copyright (C) 2025, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22#pragma once
23
24#include "musx/dom/BaseClasses.h"
25#include "musx/dom/Others.h"
26#include "musx/dom/Details.h"
27#include "musx/xml/XmlInterface.h"
28#include "FactoryBase.h"
29
30#ifndef DOXYGEN_SHOULD_IGNORE_THIS
31
32namespace musx {
33namespace factory {
34
35using namespace ::musx::xml;
36using namespace ::musx::dom::others;
37
38// Field populators are maintained to populate in the order that nodes are observed to occur in EnigmaXml.
39// The goal is that this may facilitate serialization in the future.
40
41template <>
42inline Enclosure::Shape toEnum<Enclosure::Shape>(const uint8_t& value)
43{
44 Enclosure::Shape result{};
45 if (value >= static_cast<uint8_t>(Enclosure::Shape::NoEnclosure) &&
46 value <= static_cast<uint8_t>(Enclosure::Shape::Octogon)) {
47 result = static_cast<Enclosure::Shape>(value);
48 } else {
49 MUSX_UNKNOWN_XML("Invalid <sides> value in XML for enclosure: " + std::to_string(value));
50 }
51 return result;
52}
53
54template <>
55struct FieldPopulator<DrumStaffStyle> : private FieldPopulator<DrumStaff>
56{
57 using FieldPopulator<DrumStaff>::populate;
58};
59
60template <>
61struct FieldPopulator<MarkingCategoryName> : private FieldPopulator<OthersName>
62{
63 using FieldPopulator<OthersName>::populate;
64};
65
66template <>
67struct FieldPopulator<NamePositionAbbreviated> : private FieldPopulator<NamePositioning>
68{
69 using FieldPopulator<NamePositioning>::populate;
70};
71
72template <>
73struct FieldPopulator<NamePositionStyleAbbreviated> : private FieldPopulator<NamePositioning>
74{
75 using FieldPopulator<NamePositioning>::populate;
76};
77
78template <>
79struct FieldPopulator<NamePositionFull> : private FieldPopulator<NamePositioning>
80{
81 using FieldPopulator<NamePositioning>::populate;
82};
83
84template <>
85struct FieldPopulator<NamePositionStyleFull> : private FieldPopulator<NamePositioning>
86{
87 using FieldPopulator<NamePositioning>::populate;
88};
89
90template <>
91struct FieldPopulator<RepeatBackIndividualPositioning> : private FieldPopulator<RepeatIndividualPositioning>
92{
93 using FieldPopulator<RepeatIndividualPositioning>::populate;
94};
95
96template <>
97struct FieldPopulator<RepeatEndingStartIndividualPositioning> : private FieldPopulator<RepeatIndividualPositioning>
98{
99 using FieldPopulator<RepeatIndividualPositioning>::populate;
100};
101
102template <>
103struct FieldPopulator<RepeatEndingTextIndividualPositioning> : private FieldPopulator<RepeatIndividualPositioning>
104{
105 using FieldPopulator<RepeatIndividualPositioning>::populate;
106};
107
108template <>
109struct FieldPopulator<TextRepeatIndividualPositioning> : private FieldPopulator<RepeatIndividualPositioning>
110{
111 using FieldPopulator<RepeatIndividualPositioning>::populate;
112};
113
114template <>
115struct FieldPopulator<StaffListCategoryName> : private FieldPopulator<OthersName>
116{
117 using FieldPopulator<OthersName>::populate;
118};
119
120template <>
121struct FieldPopulator<StaffListCategoryParts> : private FieldPopulator<StaffList>
122{
123 using FieldPopulator<StaffList>::populate;
124};
125
126template <>
127struct FieldPopulator<StaffListCategoryScore> : private FieldPopulator<StaffList>
128{
129 using FieldPopulator<StaffList>::populate;
130};
131
132template <>
133struct FieldPopulator<StaffListRepeatName> : private FieldPopulator<OthersName>
134{
135 using FieldPopulator<OthersName>::populate;
136};
137
138template <>
139struct FieldPopulator<StaffListRepeatParts> : private FieldPopulator<StaffList>
140{
141 using FieldPopulator<StaffList>::populate;
142};
143
144template <>
145struct FieldPopulator<StaffListRepeatPartsForced> : private FieldPopulator<StaffList>
146{
147 using FieldPopulator<StaffList>::populate;
148};
149
150template <>
151struct FieldPopulator<StaffListRepeatScore> : private FieldPopulator<StaffList>
152{
153 using FieldPopulator<StaffList>::populate;
154};
155
156template <>
157struct FieldPopulator<StaffListRepeatScoreForced> : private FieldPopulator<StaffList>
158{
159 using FieldPopulator<StaffList>::populate;
160};
161
162template <>
163struct FieldPopulator<TextExpressionEnclosure> : private FieldPopulator<Enclosure>
164{
165 using FieldPopulator<Enclosure>::populate;
166};
167
168template <>
169struct FieldPopulator<TextRepeatEnclosure> : private FieldPopulator<Enclosure>
170{
171 using FieldPopulator<Enclosure>::populate;
172};
173
174} // namespace factory
175} // namespace musx
176
177#endif // DOXYGEN_SHOULD_IGNORE THIS
Classes in the OthersPool.
Definition CommonClasses.h:55
Provides interfaces and optional implementations for traversing XML.
Definition PugiXmlImpl.h:33
object model for musx file (enigmaxml)
Definition BaseClasses.h:38