From 21a464433d80c50bbb0941f64e364357bf10bdb2 Mon Sep 17 00:00:00 2001 From: Matthew James Briggs Date: Sat, 27 Jun 2026 18:00:25 +0200 Subject: [PATCH 1/2] gen: remove anonymous namespace from enum.cpp.tmpl Replace the anonymous namespace wrapping kWire[] with a per-type name (k{{ident}}Wire) so that unity builds can include multiple generated enum .cpp files in a single translation unit without redefinition errors. --- gen/cpp/templates/enum.cpp.tmpl | 13 ++++-------- gen/cpp/templates/number.cpp.tmpl | 13 ++++-------- gen/cpp/templates/smufl_prefixed.cpp.tmpl | 25 +++++++++-------------- gen/cpp/templates/string.cpp.tmpl | 13 ++++-------- 4 files changed, 22 insertions(+), 42 deletions(-) diff --git a/gen/cpp/templates/enum.cpp.tmpl b/gen/cpp/templates/enum.cpp.tmpl index 2b72bfc90..1b7254392 100644 --- a/gen/cpp/templates/enum.cpp.tmpl +++ b/gen/cpp/templates/enum.cpp.tmpl @@ -8,17 +8,12 @@ namespace {{vars.namespace}} { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view k{{ident}}Wire[] = { {{#variants}} {{name.wire_q}}, {{/variants}} }; -} // namespace - {{#variants}} {{type.ident}} {{type.ident}}::{{ident}}() noexcept { @@ -28,14 +23,14 @@ constexpr std::string_view kWire[] = { {{/variants}} std::string_view {{ident}}::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return k{{ident}}Wire[static_cast(m_tag)]; } bool {{ident}}::tryParse(std::string_view text, {{ident}} &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(k{{ident}}Wire); ++i) { - if (kWire[i] == text) + if (k{{ident}}Wire[i] == text) { out = {{ident}}{static_cast(i)}; return true; diff --git a/gen/cpp/templates/number.cpp.tmpl b/gen/cpp/templates/number.cpp.tmpl index 3dadf6d1d..b08d6cb82 100644 --- a/gen/cpp/templates/number.cpp.tmpl +++ b/gen/cpp/templates/number.cpp.tmpl @@ -9,10 +9,7 @@ namespace {{vars.namespace}} { -namespace -{ - -{{target_type}} clamped({{target_type}} v) +{{target_type}} clamped{{ident}}({{target_type}} v) { {{#clamp}} {{#type.is_decimal}} @@ -31,19 +28,17 @@ namespace return v; } -} // namespace - -{{ident}}::{{ident}}() : m_value{clamped({{target_type}}{})} +{{ident}}::{{ident}}() : m_value{clamped{{ident}}({{target_type}}{})} { } -{{ident}}::{{ident}}({{target_type}} value) : m_value{clamped(std::move(value))} +{{ident}}::{{ident}}({{target_type}} value) : m_value{clamped{{ident}}(std::move(value))} { } void {{ident}}::setValue({{target_type}} value) { - m_value = clamped(std::move(value)); + m_value = clamped{{ident}}(std::move(value)); } std::string {{ident}}::toString() const diff --git a/gen/cpp/templates/smufl_prefixed.cpp.tmpl b/gen/cpp/templates/smufl_prefixed.cpp.tmpl index 1ac09f599..a3eddd9c4 100644 --- a/gen/cpp/templates/smufl_prefixed.cpp.tmpl +++ b/gen/cpp/templates/smufl_prefixed.cpp.tmpl @@ -9,24 +9,19 @@ namespace {{vars.namespace}} { -namespace -{ - -constexpr std::string_view kPrefix[] = { +constexpr std::string_view k{{ident}}Prefix[] = { {{#prefixes}} {{name.wire_q}}, {{/prefixes}} }; // The ASCII subset of XML name characters the schema's \c denotes. -bool isNameChar(char c) noexcept +bool isNameChar{{ident}}(char c) noexcept { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '.' || c == ':' || c == '_'; } -} // namespace - {{ident}}::{{ident}}() { repair(); @@ -46,7 +41,7 @@ bool isNameChar(char c) noexcept void {{ident}}::setPrefix(Prefix value) noexcept { m_prefix = value; - if (static_cast(m_prefix) >= std::size(kPrefix)) + if (static_cast(m_prefix) >= std::size(k{{ident}}Prefix)) { m_prefix = Prefix::{{#prefixes}}{{#is_first}}{{ident}}{{/is_first}}{{/prefixes}}; } @@ -62,7 +57,7 @@ void {{ident}}::setSuffix(std::string value) void {{ident}}::repair() { {{#multi_prefix}} - if (static_cast(m_prefix) >= std::size(kPrefix)) + if (static_cast(m_prefix) >= std::size(k{{ident}}Prefix)) { m_prefix = Prefix::{{#prefixes}}{{#is_first}}{{ident}}{{/is_first}}{{/prefixes}}; } @@ -71,7 +66,7 @@ void {{ident}}::repair() cleaned.reserve(m_suffix.size()); for (const char c : m_suffix) { - if (isNameChar(c)) + if (isNameChar{{ident}}(c)) { cleaned.push_back(c); } @@ -88,10 +83,10 @@ void {{ident}}::repair() std::string {{ident}}::toString() const { {{#multi_prefix}} - std::string out{kPrefix[static_cast(m_prefix)]}; + std::string out{k{{ident}}Prefix[static_cast(m_prefix)]}; {{/multi_prefix}} {{^multi_prefix}} - std::string out{kPrefix[0]}; + std::string out{k{{ident}}Prefix[0]}; {{/multi_prefix}} out += m_suffix; return out; @@ -99,9 +94,9 @@ std::string {{ident}}::toString() const bool {{ident}}::tryParse(std::string_view text, {{ident}} &out) { - for (std::size_t i = 0; i < std::size(kPrefix); ++i) + for (std::size_t i = 0; i < std::size(k{{ident}}Prefix); ++i) { - const std::string_view prefix = kPrefix[i]; + const std::string_view prefix = k{{ident}}Prefix[i]; if (text.size() < prefix.size() || text.substr(0, prefix.size()) != prefix) { continue; @@ -116,7 +111,7 @@ bool {{ident}}::tryParse(std::string_view text, {{ident}} &out) bool valid = true; for (const char c : suffix) { - if (!isNameChar(c)) + if (!isNameChar{{ident}}(c)) { valid = false; break; diff --git a/gen/cpp/templates/string.cpp.tmpl b/gen/cpp/templates/string.cpp.tmpl index 9868da5c3..9334f53c7 100644 --- a/gen/cpp/templates/string.cpp.tmpl +++ b/gen/cpp/templates/string.cpp.tmpl @@ -7,10 +7,7 @@ namespace {{vars.namespace}} { -namespace -{ - -std::string repaired(std::string v) +std::string repaired{{ident}}(std::string v) { {{#min_length}} // Deterministic repair to the schema's minLength (plan ยง2.2.2): pad @@ -23,21 +20,19 @@ std::string repaired(std::string v) return v; } -} // namespace - {{#min_length}} -{{ident}}::{{ident}}() : m_value{repaired(std::string{})} +{{ident}}::{{ident}}() : m_value{repaired{{ident}}(std::string{})} { } {{/min_length}} -{{ident}}::{{ident}}(std::string value) : m_value{repaired(std::move(value))} +{{ident}}::{{ident}}(std::string value) : m_value{repaired{{ident}}(std::move(value))} { } void {{ident}}::setValue(std::string value) { - m_value = repaired(std::move(value)); + m_value = repaired{{ident}}(std::move(value)); } bool {{ident}}::tryParse(std::string_view text, {{ident}} &out) From 0c320a6150e7013391493cad6d58b5c646abb1b4 Mon Sep 17 00:00:00 2001 From: Matthew James Briggs Date: Sat, 27 Jun 2026 18:09:33 +0200 Subject: [PATCH 2/2] gen(cpp): regenerate enum impls without anonymous namespace --- src/private/mx/core/generated/AboveBelow.cpp | 13 ++++------- .../mx/core/generated/AccidentalValue.cpp | 13 ++++------- .../mx/core/generated/AccordionMiddle.cpp | 13 ++++------- .../mx/core/generated/ArrowDirection.cpp | 13 ++++------- src/private/mx/core/generated/ArrowStyle.cpp | 13 ++++------- .../mx/core/generated/BackwardForward.cpp | 13 ++++------- src/private/mx/core/generated/BarStyle.cpp | 13 ++++------- src/private/mx/core/generated/BeamLevel.cpp | 13 ++++------- src/private/mx/core/generated/BeamValue.cpp | 13 ++++------- src/private/mx/core/generated/BeaterValue.cpp | 13 ++++------- src/private/mx/core/generated/BendShape.cpp | 13 ++++------- .../mx/core/generated/BreathMarkValue.cpp | 13 ++++------- src/private/mx/core/generated/CSSFontSize.cpp | 13 ++++------- .../mx/core/generated/CaesuraValue.cpp | 13 ++++------- .../mx/core/generated/CancelLocation.cpp | 13 ++++------- .../mx/core/generated/CircularArrow.cpp | 13 ++++------- src/private/mx/core/generated/ClefSign.cpp | 13 ++++------- .../mx/core/generated/DegreeSymbolValue.cpp | 13 ++++------- .../mx/core/generated/DegreeTypeValue.cpp | 13 ++++------- .../mx/core/generated/DistanceType.cpp | 11 +++------ src/private/mx/core/generated/Divisions.cpp | 13 ++++------- src/private/mx/core/generated/EffectValue.cpp | 13 ++++------- .../mx/core/generated/EnclosureShape.cpp | 13 ++++------- src/private/mx/core/generated/Fan.cpp | 13 ++++------- .../mx/core/generated/FermataShape.cpp | 13 ++++------- src/private/mx/core/generated/Fifths.cpp | 13 ++++------- src/private/mx/core/generated/FontStyle.cpp | 13 ++++------- src/private/mx/core/generated/FontWeight.cpp | 13 ++++------- src/private/mx/core/generated/GlassValue.cpp | 13 ++++------- src/private/mx/core/generated/GlyphType.cpp | 11 +++------ .../mx/core/generated/GroupBarlineValue.cpp | 13 ++++------- .../mx/core/generated/GroupSymbolValue.cpp | 13 ++++------- .../mx/core/generated/HandbellValue.cpp | 13 ++++------- .../core/generated/HarmonClosedLocation.cpp | 13 ++++------- .../mx/core/generated/HarmonClosedValue.cpp | 13 ++++------- .../mx/core/generated/HarmonyArrangement.cpp | 13 ++++------- src/private/mx/core/generated/HarmonyType.cpp | 13 ++++------- .../mx/core/generated/HoleClosedLocation.cpp | 13 ++++------- .../mx/core/generated/HoleClosedValue.cpp | 13 ++++------- src/private/mx/core/generated/KindValue.cpp | 13 ++++------- .../mx/core/generated/LeftCenterRight.cpp | 13 ++++------- src/private/mx/core/generated/LeftRight.cpp | 13 ++++------- src/private/mx/core/generated/LineEnd.cpp | 13 ++++------- src/private/mx/core/generated/LineLength.cpp | 13 ++++------- src/private/mx/core/generated/LineShape.cpp | 13 ++++------- src/private/mx/core/generated/LineType.cpp | 13 ++++------- .../mx/core/generated/LineWidthType.cpp | 11 +++------ src/private/mx/core/generated/MIDI128.cpp | 13 ++++------- src/private/mx/core/generated/MIDI16.cpp | 13 ++++------- src/private/mx/core/generated/MIDI16384.cpp | 13 ++++------- src/private/mx/core/generated/MarginType.cpp | 13 ++++------- .../core/generated/MeasureNumberingValue.cpp | 13 ++++------- src/private/mx/core/generated/MeasureText.cpp | 13 ++++------- .../mx/core/generated/MembraneValue.cpp | 13 ++++------- src/private/mx/core/generated/MetalValue.cpp | 13 ++++------- src/private/mx/core/generated/Millimeters.cpp | 13 ++++------- .../mx/core/generated/Milliseconds.cpp | 13 ++++------- src/private/mx/core/generated/Mode.cpp | 11 +++------ src/private/mx/core/generated/Mute.cpp | 13 ++++------- .../mx/core/generated/NonNegativeDecimal.cpp | 13 ++++------- .../mx/core/generated/NoteSizeType.cpp | 13 ++++------- .../mx/core/generated/NoteTypeValue.cpp | 13 ++++------- .../mx/core/generated/NoteheadValue.cpp | 13 ++++------- src/private/mx/core/generated/NumberLevel.cpp | 13 ++++------- .../mx/core/generated/NumberOfLines.cpp | 13 ++++------- src/private/mx/core/generated/NumeralMode.cpp | 13 ++++------- .../mx/core/generated/NumeralValue.cpp | 13 ++++------- src/private/mx/core/generated/Octave.cpp | 13 ++++------- src/private/mx/core/generated/OnOff.cpp | 13 ++++------- src/private/mx/core/generated/OverUnder.cpp | 13 ++++------- src/private/mx/core/generated/PedalType.cpp | 13 ++++------- src/private/mx/core/generated/Percent.cpp | 13 ++++------- .../mx/core/generated/PitchedValue.cpp | 13 ++++------- .../mx/core/generated/PositiveDivisions.cpp | 13 ++++------- .../core/generated/PrincipalVoiceSymbol.cpp | 13 ++++------- .../mx/core/generated/RightLeftMiddle.cpp | 13 ++++------- .../mx/core/generated/RotationDegrees.cpp | 13 ++++------- src/private/mx/core/generated/SemiPitched.cpp | 13 ++++------- src/private/mx/core/generated/Semitones.cpp | 13 ++++------- src/private/mx/core/generated/ShowFrets.cpp | 13 ++++------- src/private/mx/core/generated/ShowTuplet.cpp | 13 ++++------- .../generated/SmuflAccidentalGlyphName.cpp | 23 ++++++++----------- .../mx/core/generated/SmuflCodaGlyphName.cpp | 19 ++++++--------- .../core/generated/SmuflLyricsGlyphName.cpp | 19 ++++++--------- .../generated/SmuflPictogramGlyphName.cpp | 19 ++++++--------- .../mx/core/generated/SmuflSegnoGlyphName.cpp | 19 ++++++--------- src/private/mx/core/generated/SoundID.cpp | 13 ++++------- .../mx/core/generated/StaffDivideSymbol.cpp | 13 ++++------- src/private/mx/core/generated/StaffLine.cpp | 13 ++++------- .../mx/core/generated/StaffLinePosition.cpp | 13 ++++------- src/private/mx/core/generated/StaffNumber.cpp | 13 ++++------- src/private/mx/core/generated/StaffType.cpp | 13 ++++------- src/private/mx/core/generated/StartNote.cpp | 13 ++++------- src/private/mx/core/generated/StartStop.cpp | 13 ++++------- .../mx/core/generated/StartStopContinue.cpp | 13 ++++------- .../core/generated/StartStopDiscontinue.cpp | 13 ++++------- .../mx/core/generated/StartStopSingle.cpp | 13 ++++------- src/private/mx/core/generated/StemValue.cpp | 13 ++++------- src/private/mx/core/generated/Step.cpp | 13 ++++------- .../mx/core/generated/StickLocation.cpp | 13 ++++------- .../mx/core/generated/StickMaterial.cpp | 13 ++++------- src/private/mx/core/generated/StickType.cpp | 13 ++++------- .../mx/core/generated/StringNumber.cpp | 13 ++++------- .../mx/core/generated/SwingTypeValue.cpp | 13 ++++------- src/private/mx/core/generated/Syllabic.cpp | 13 ++++------- src/private/mx/core/generated/SymbolSize.cpp | 13 ++++------- src/private/mx/core/generated/SyncType.cpp | 13 ++++------- .../mx/core/generated/SystemRelation.cpp | 13 ++++------- .../core/generated/SystemRelationNumber.cpp | 13 ++++------- src/private/mx/core/generated/TapHand.cpp | 13 ++++------- src/private/mx/core/generated/Tenths.cpp | 13 ++++------- .../mx/core/generated/TextDirection.cpp | 13 ++++------- src/private/mx/core/generated/TiedType.cpp | 13 ++++------- .../mx/core/generated/TimeRelation.cpp | 13 ++++------- .../mx/core/generated/TimeSeparator.cpp | 13 ++++------- src/private/mx/core/generated/TimeSymbol.cpp | 13 ++++------- .../mx/core/generated/TipDirection.cpp | 13 ++++------- src/private/mx/core/generated/TopBottom.cpp | 13 ++++------- .../mx/core/generated/TremoloMarks.cpp | 13 ++++------- src/private/mx/core/generated/TremoloType.cpp | 13 ++++------- src/private/mx/core/generated/TrillBeats.cpp | 13 ++++------- src/private/mx/core/generated/TrillStep.cpp | 13 ++++------- src/private/mx/core/generated/TwoNoteTurn.cpp | 13 ++++------- src/private/mx/core/generated/UpDown.cpp | 13 ++++------- .../mx/core/generated/UpDownStopContinue.cpp | 13 ++++------- .../mx/core/generated/UprightInverted.cpp | 13 ++++------- src/private/mx/core/generated/Valign.cpp | 13 ++++------- src/private/mx/core/generated/ValignImage.cpp | 13 ++++------- src/private/mx/core/generated/WedgeType.cpp | 13 ++++------- src/private/mx/core/generated/Winged.cpp | 13 ++++------- src/private/mx/core/generated/WoodValue.cpp | 13 ++++------- src/private/mx/core/generated/YesNo.cpp | 13 ++++------- 132 files changed, 541 insertions(+), 1201 deletions(-) diff --git a/src/private/mx/core/generated/AboveBelow.cpp b/src/private/mx/core/generated/AboveBelow.cpp index 5c8e66319..9997528cc 100644 --- a/src/private/mx/core/generated/AboveBelow.cpp +++ b/src/private/mx/core/generated/AboveBelow.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kAboveBelowWire[] = { "above", "below", }; -} // namespace - AboveBelow AboveBelow::above() noexcept { return AboveBelow{Tag::above}; @@ -30,14 +25,14 @@ AboveBelow AboveBelow::below() noexcept std::string_view AboveBelow::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kAboveBelowWire[static_cast(m_tag)]; } bool AboveBelow::tryParse(std::string_view text, AboveBelow &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kAboveBelowWire); ++i) { - if (kWire[i] == text) + if (kAboveBelowWire[i] == text) { out = AboveBelow{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/AccidentalValue.cpp b/src/private/mx/core/generated/AccidentalValue.cpp index 3f9635e9c..08eea51b2 100644 --- a/src/private/mx/core/generated/AccidentalValue.cpp +++ b/src/private/mx/core/generated/AccidentalValue.cpp @@ -8,10 +8,7 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kAccidentalValueWire[] = { "sharp", "natural", "flat", @@ -55,8 +52,6 @@ constexpr std::string_view kWire[] = { "other", }; -} // namespace - AccidentalValue AccidentalValue::sharp() noexcept { return AccidentalValue{Tag::sharp}; @@ -264,14 +259,14 @@ AccidentalValue AccidentalValue::other() noexcept std::string_view AccidentalValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kAccidentalValueWire[static_cast(m_tag)]; } bool AccidentalValue::tryParse(std::string_view text, AccidentalValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kAccidentalValueWire); ++i) { - if (kWire[i] == text) + if (kAccidentalValueWire[i] == text) { out = AccidentalValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/AccordionMiddle.cpp b/src/private/mx/core/generated/AccordionMiddle.cpp index 2c28fb073..03c0dde6d 100644 --- a/src/private/mx/core/generated/AccordionMiddle.cpp +++ b/src/private/mx/core/generated/AccordionMiddle.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedAccordionMiddle(int v) { if (v < 1) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -AccordionMiddle::AccordionMiddle() : m_value{clamped(int{})} +AccordionMiddle::AccordionMiddle() : m_value{clampedAccordionMiddle(int{})} { } -AccordionMiddle::AccordionMiddle(int value) : m_value{clamped(std::move(value))} +AccordionMiddle::AccordionMiddle(int value) : m_value{clampedAccordionMiddle(std::move(value))} { } void AccordionMiddle::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedAccordionMiddle(std::move(value)); } std::string AccordionMiddle::toString() const diff --git a/src/private/mx/core/generated/ArrowDirection.cpp b/src/private/mx/core/generated/ArrowDirection.cpp index cc91815fe..680f73192 100644 --- a/src/private/mx/core/generated/ArrowDirection.cpp +++ b/src/private/mx/core/generated/ArrowDirection.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kArrowDirectionWire[] = { "left", "up", "right", "down", "northwest", "northeast", "southeast", "southwest", "left right", "up down", "northwest southeast", "northeast southwest", "other", }; -} // namespace - ArrowDirection ArrowDirection::left() noexcept { return ArrowDirection{Tag::left}; @@ -86,14 +81,14 @@ ArrowDirection ArrowDirection::other() noexcept std::string_view ArrowDirection::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kArrowDirectionWire[static_cast(m_tag)]; } bool ArrowDirection::tryParse(std::string_view text, ArrowDirection &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kArrowDirectionWire); ++i) { - if (kWire[i] == text) + if (kArrowDirectionWire[i] == text) { out = ArrowDirection{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/ArrowStyle.cpp b/src/private/mx/core/generated/ArrowStyle.cpp index 302b0c230..dbe9a8636 100644 --- a/src/private/mx/core/generated/ArrowStyle.cpp +++ b/src/private/mx/core/generated/ArrowStyle.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kArrowStyleWire[] = { "single", "double", "filled", "hollow", "paired", "combined", "other", }; -} // namespace - ArrowStyle ArrowStyle::single() noexcept { return ArrowStyle{Tag::single}; @@ -54,14 +49,14 @@ ArrowStyle ArrowStyle::other() noexcept std::string_view ArrowStyle::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kArrowStyleWire[static_cast(m_tag)]; } bool ArrowStyle::tryParse(std::string_view text, ArrowStyle &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kArrowStyleWire); ++i) { - if (kWire[i] == text) + if (kArrowStyleWire[i] == text) { out = ArrowStyle{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/BackwardForward.cpp b/src/private/mx/core/generated/BackwardForward.cpp index 888802f08..3fc85239f 100644 --- a/src/private/mx/core/generated/BackwardForward.cpp +++ b/src/private/mx/core/generated/BackwardForward.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kBackwardForwardWire[] = { "backward", "forward", }; -} // namespace - BackwardForward BackwardForward::backward() noexcept { return BackwardForward{Tag::backward}; @@ -30,14 +25,14 @@ BackwardForward BackwardForward::forward() noexcept std::string_view BackwardForward::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kBackwardForwardWire[static_cast(m_tag)]; } bool BackwardForward::tryParse(std::string_view text, BackwardForward &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kBackwardForwardWire); ++i) { - if (kWire[i] == text) + if (kBackwardForwardWire[i] == text) { out = BackwardForward{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/BarStyle.cpp b/src/private/mx/core/generated/BarStyle.cpp index d836889dc..91e0cdcda 100644 --- a/src/private/mx/core/generated/BarStyle.cpp +++ b/src/private/mx/core/generated/BarStyle.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kBarStyleWire[] = { "regular", "dotted", "dashed", "heavy", "light-light", "light-heavy", "heavy-light", "heavy-heavy", "tick", "short", "none", }; -} // namespace - BarStyle BarStyle::regular() noexcept { return BarStyle{Tag::regular}; @@ -75,14 +70,14 @@ BarStyle BarStyle::none() noexcept std::string_view BarStyle::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kBarStyleWire[static_cast(m_tag)]; } bool BarStyle::tryParse(std::string_view text, BarStyle &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kBarStyleWire); ++i) { - if (kWire[i] == text) + if (kBarStyleWire[i] == text) { out = BarStyle{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/BeamLevel.cpp b/src/private/mx/core/generated/BeamLevel.cpp index e322b363e..21a0012e2 100644 --- a/src/private/mx/core/generated/BeamLevel.cpp +++ b/src/private/mx/core/generated/BeamLevel.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedBeamLevel(int v) { if (v < 1) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -BeamLevel::BeamLevel() : m_value{clamped(int{})} +BeamLevel::BeamLevel() : m_value{clampedBeamLevel(int{})} { } -BeamLevel::BeamLevel(int value) : m_value{clamped(std::move(value))} +BeamLevel::BeamLevel(int value) : m_value{clampedBeamLevel(std::move(value))} { } void BeamLevel::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedBeamLevel(std::move(value)); } std::string BeamLevel::toString() const diff --git a/src/private/mx/core/generated/BeamValue.cpp b/src/private/mx/core/generated/BeamValue.cpp index 5db765d06..748b414ac 100644 --- a/src/private/mx/core/generated/BeamValue.cpp +++ b/src/private/mx/core/generated/BeamValue.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kBeamValueWire[] = { "begin", "continue", "end", "forward hook", "backward hook", }; -} // namespace - BeamValue BeamValue::begin() noexcept { return BeamValue{Tag::begin}; @@ -44,14 +39,14 @@ BeamValue BeamValue::backwardHook() noexcept std::string_view BeamValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kBeamValueWire[static_cast(m_tag)]; } bool BeamValue::tryParse(std::string_view text, BeamValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kBeamValueWire); ++i) { - if (kWire[i] == text) + if (kBeamValueWire[i] == text) { out = BeamValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/BeaterValue.cpp b/src/private/mx/core/generated/BeaterValue.cpp index 400890491..499931e7e 100644 --- a/src/private/mx/core/generated/BeaterValue.cpp +++ b/src/private/mx/core/generated/BeaterValue.cpp @@ -8,10 +8,7 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kBeaterValueWire[] = { "bow", "chime hammer", "coin", @@ -34,8 +31,6 @@ constexpr std::string_view kWire[] = { "wire brush", }; -} // namespace - BeaterValue BeaterValue::bow() noexcept { return BeaterValue{Tag::bow}; @@ -138,14 +133,14 @@ BeaterValue BeaterValue::wireBrush() noexcept std::string_view BeaterValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kBeaterValueWire[static_cast(m_tag)]; } bool BeaterValue::tryParse(std::string_view text, BeaterValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kBeaterValueWire); ++i) { - if (kWire[i] == text) + if (kBeaterValueWire[i] == text) { out = BeaterValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/BendShape.cpp b/src/private/mx/core/generated/BendShape.cpp index e8609a9e6..a3675a69c 100644 --- a/src/private/mx/core/generated/BendShape.cpp +++ b/src/private/mx/core/generated/BendShape.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kBendShapeWire[] = { "angled", "curved", }; -} // namespace - BendShape BendShape::angled() noexcept { return BendShape{Tag::angled}; @@ -30,14 +25,14 @@ BendShape BendShape::curved() noexcept std::string_view BendShape::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kBendShapeWire[static_cast(m_tag)]; } bool BendShape::tryParse(std::string_view text, BendShape &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kBendShapeWire); ++i) { - if (kWire[i] == text) + if (kBendShapeWire[i] == text) { out = BendShape{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/BreathMarkValue.cpp b/src/private/mx/core/generated/BreathMarkValue.cpp index 608a2faba..8ececee9e 100644 --- a/src/private/mx/core/generated/BreathMarkValue.cpp +++ b/src/private/mx/core/generated/BreathMarkValue.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kBreathMarkValueWire[] = { "", "comma", "tick", "upbow", "salzedo", }; -} // namespace - BreathMarkValue BreathMarkValue::empty() noexcept { return BreathMarkValue{Tag::empty}; @@ -44,14 +39,14 @@ BreathMarkValue BreathMarkValue::salzedo() noexcept std::string_view BreathMarkValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kBreathMarkValueWire[static_cast(m_tag)]; } bool BreathMarkValue::tryParse(std::string_view text, BreathMarkValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kBreathMarkValueWire); ++i) { - if (kWire[i] == text) + if (kBreathMarkValueWire[i] == text) { out = BreathMarkValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/CSSFontSize.cpp b/src/private/mx/core/generated/CSSFontSize.cpp index a903d5918..7780b8d7a 100644 --- a/src/private/mx/core/generated/CSSFontSize.cpp +++ b/src/private/mx/core/generated/CSSFontSize.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kCSSFontSizeWire[] = { "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", }; -} // namespace - CSSFontSize CSSFontSize::xxSmall() noexcept { return CSSFontSize{Tag::xxSmall}; @@ -54,14 +49,14 @@ CSSFontSize CSSFontSize::xxLarge() noexcept std::string_view CSSFontSize::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kCSSFontSizeWire[static_cast(m_tag)]; } bool CSSFontSize::tryParse(std::string_view text, CSSFontSize &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kCSSFontSizeWire); ++i) { - if (kWire[i] == text) + if (kCSSFontSizeWire[i] == text) { out = CSSFontSize{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/CaesuraValue.cpp b/src/private/mx/core/generated/CaesuraValue.cpp index b2c93cca3..af5dc8564 100644 --- a/src/private/mx/core/generated/CaesuraValue.cpp +++ b/src/private/mx/core/generated/CaesuraValue.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kCaesuraValueWire[] = { "normal", "thick", "short", "curved", "single", "", }; -} // namespace - CaesuraValue CaesuraValue::normal() noexcept { return CaesuraValue{Tag::normal}; @@ -49,14 +44,14 @@ CaesuraValue CaesuraValue::empty() noexcept std::string_view CaesuraValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kCaesuraValueWire[static_cast(m_tag)]; } bool CaesuraValue::tryParse(std::string_view text, CaesuraValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kCaesuraValueWire); ++i) { - if (kWire[i] == text) + if (kCaesuraValueWire[i] == text) { out = CaesuraValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/CancelLocation.cpp b/src/private/mx/core/generated/CancelLocation.cpp index 08e58dac6..be8e5a88b 100644 --- a/src/private/mx/core/generated/CancelLocation.cpp +++ b/src/private/mx/core/generated/CancelLocation.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kCancelLocationWire[] = { "left", "right", "before-barline", }; -} // namespace - CancelLocation CancelLocation::left() noexcept { return CancelLocation{Tag::left}; @@ -36,14 +31,14 @@ CancelLocation CancelLocation::beforeBarline() noexcept std::string_view CancelLocation::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kCancelLocationWire[static_cast(m_tag)]; } bool CancelLocation::tryParse(std::string_view text, CancelLocation &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kCancelLocationWire); ++i) { - if (kWire[i] == text) + if (kCancelLocationWire[i] == text) { out = CancelLocation{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/CircularArrow.cpp b/src/private/mx/core/generated/CircularArrow.cpp index 9c0455067..32e7aa641 100644 --- a/src/private/mx/core/generated/CircularArrow.cpp +++ b/src/private/mx/core/generated/CircularArrow.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kCircularArrowWire[] = { "clockwise", "anticlockwise", }; -} // namespace - CircularArrow CircularArrow::clockwise() noexcept { return CircularArrow{Tag::clockwise}; @@ -30,14 +25,14 @@ CircularArrow CircularArrow::anticlockwise() noexcept std::string_view CircularArrow::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kCircularArrowWire[static_cast(m_tag)]; } bool CircularArrow::tryParse(std::string_view text, CircularArrow &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kCircularArrowWire); ++i) { - if (kWire[i] == text) + if (kCircularArrowWire[i] == text) { out = CircularArrow{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/ClefSign.cpp b/src/private/mx/core/generated/ClefSign.cpp index 112e95e97..0bd6cf61e 100644 --- a/src/private/mx/core/generated/ClefSign.cpp +++ b/src/private/mx/core/generated/ClefSign.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kClefSignWire[] = { "G", "F", "C", "percussion", "TAB", "jianpu", "none", }; -} // namespace - ClefSign ClefSign::g() noexcept { return ClefSign{Tag::g}; @@ -54,14 +49,14 @@ ClefSign ClefSign::none() noexcept std::string_view ClefSign::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kClefSignWire[static_cast(m_tag)]; } bool ClefSign::tryParse(std::string_view text, ClefSign &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kClefSignWire); ++i) { - if (kWire[i] == text) + if (kClefSignWire[i] == text) { out = ClefSign{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/DegreeSymbolValue.cpp b/src/private/mx/core/generated/DegreeSymbolValue.cpp index 60568ccd0..0b9dde810 100644 --- a/src/private/mx/core/generated/DegreeSymbolValue.cpp +++ b/src/private/mx/core/generated/DegreeSymbolValue.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kDegreeSymbolValueWire[] = { "major", "minor", "augmented", "diminished", "half-diminished", }; -} // namespace - DegreeSymbolValue DegreeSymbolValue::major() noexcept { return DegreeSymbolValue{Tag::major}; @@ -44,14 +39,14 @@ DegreeSymbolValue DegreeSymbolValue::halfDiminished() noexcept std::string_view DegreeSymbolValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kDegreeSymbolValueWire[static_cast(m_tag)]; } bool DegreeSymbolValue::tryParse(std::string_view text, DegreeSymbolValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kDegreeSymbolValueWire); ++i) { - if (kWire[i] == text) + if (kDegreeSymbolValueWire[i] == text) { out = DegreeSymbolValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/DegreeTypeValue.cpp b/src/private/mx/core/generated/DegreeTypeValue.cpp index 4a5562637..27f86f312 100644 --- a/src/private/mx/core/generated/DegreeTypeValue.cpp +++ b/src/private/mx/core/generated/DegreeTypeValue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kDegreeTypeValueWire[] = { "add", "alter", "subtract", }; -} // namespace - DegreeTypeValue DegreeTypeValue::add() noexcept { return DegreeTypeValue{Tag::add}; @@ -36,14 +31,14 @@ DegreeTypeValue DegreeTypeValue::subtract() noexcept std::string_view DegreeTypeValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kDegreeTypeValueWire[static_cast(m_tag)]; } bool DegreeTypeValue::tryParse(std::string_view text, DegreeTypeValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kDegreeTypeValueWire); ++i) { - if (kWire[i] == text) + if (kDegreeTypeValueWire[i] == text) { out = DegreeTypeValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/DistanceType.cpp b/src/private/mx/core/generated/DistanceType.cpp index 55f531cde..b46f430b6 100644 --- a/src/private/mx/core/generated/DistanceType.cpp +++ b/src/private/mx/core/generated/DistanceType.cpp @@ -7,23 +7,18 @@ namespace mx::core { -namespace -{ - -std::string repaired(std::string v) +std::string repairedDistanceType(std::string v) { return v; } -} // namespace - -DistanceType::DistanceType(std::string value) : m_value{repaired(std::move(value))} +DistanceType::DistanceType(std::string value) : m_value{repairedDistanceType(std::move(value))} { } void DistanceType::setValue(std::string value) { - m_value = repaired(std::move(value)); + m_value = repairedDistanceType(std::move(value)); } bool DistanceType::tryParse(std::string_view text, DistanceType &out) diff --git a/src/private/mx/core/generated/Divisions.cpp b/src/private/mx/core/generated/Divisions.cpp index cd4c728a2..91a724764 100644 --- a/src/private/mx/core/generated/Divisions.cpp +++ b/src/private/mx/core/generated/Divisions.cpp @@ -9,27 +9,22 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedDivisions(Decimal v) { return v; } -} // namespace - -Divisions::Divisions() : m_value{clamped(Decimal{})} +Divisions::Divisions() : m_value{clampedDivisions(Decimal{})} { } -Divisions::Divisions(Decimal value) : m_value{clamped(std::move(value))} +Divisions::Divisions(Decimal value) : m_value{clampedDivisions(std::move(value))} { } void Divisions::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedDivisions(std::move(value)); } std::string Divisions::toString() const diff --git a/src/private/mx/core/generated/EffectValue.cpp b/src/private/mx/core/generated/EffectValue.cpp index 70f12e5f9..aa2db4651 100644 --- a/src/private/mx/core/generated/EffectValue.cpp +++ b/src/private/mx/core/generated/EffectValue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kEffectValueWire[] = { "anvil", "auto horn", "bird whistle", "cannon", "duck call", "gun shot", "klaxon horn", "lions roar", "lotus flute", "megaphone", "police whistle", "siren", "slide whistle", "thunder sheet", "wind machine", "wind whistle", }; -} // namespace - EffectValue EffectValue::anvil() noexcept { return EffectValue{Tag::anvil}; @@ -101,14 +96,14 @@ EffectValue EffectValue::windWhistle() noexcept std::string_view EffectValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kEffectValueWire[static_cast(m_tag)]; } bool EffectValue::tryParse(std::string_view text, EffectValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kEffectValueWire); ++i) { - if (kWire[i] == text) + if (kEffectValueWire[i] == text) { out = EffectValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/EnclosureShape.cpp b/src/private/mx/core/generated/EnclosureShape.cpp index 7669e3af0..29beac6ad 100644 --- a/src/private/mx/core/generated/EnclosureShape.cpp +++ b/src/private/mx/core/generated/EnclosureShape.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kEnclosureShapeWire[] = { "rectangle", "square", "oval", "circle", "bracket", "inverted-bracket", "triangle", "diamond", "pentagon", "hexagon", "heptagon", "octagon", "nonagon", "decagon", "none", }; -} // namespace - EnclosureShape EnclosureShape::rectangle() noexcept { return EnclosureShape{Tag::rectangle}; @@ -95,14 +90,14 @@ EnclosureShape EnclosureShape::none() noexcept std::string_view EnclosureShape::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kEnclosureShapeWire[static_cast(m_tag)]; } bool EnclosureShape::tryParse(std::string_view text, EnclosureShape &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kEnclosureShapeWire); ++i) { - if (kWire[i] == text) + if (kEnclosureShapeWire[i] == text) { out = EnclosureShape{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Fan.cpp b/src/private/mx/core/generated/Fan.cpp index 5388483dd..6aea0f1fe 100644 --- a/src/private/mx/core/generated/Fan.cpp +++ b/src/private/mx/core/generated/Fan.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kFanWire[] = { "accel", "rit", "none", }; -} // namespace - Fan Fan::accel() noexcept { return Fan{Tag::accel}; @@ -36,14 +31,14 @@ Fan Fan::none() noexcept std::string_view Fan::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kFanWire[static_cast(m_tag)]; } bool Fan::tryParse(std::string_view text, Fan &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kFanWire); ++i) { - if (kWire[i] == text) + if (kFanWire[i] == text) { out = Fan{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/FermataShape.cpp b/src/private/mx/core/generated/FermataShape.cpp index 70ad0b32c..b095d1b1b 100644 --- a/src/private/mx/core/generated/FermataShape.cpp +++ b/src/private/mx/core/generated/FermataShape.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kFermataShapeWire[] = { "normal", "angled", "square", "double-angled", "double-square", "double-dot", "half-curve", "curlew", "", }; -} // namespace - FermataShape FermataShape::normal() noexcept { return FermataShape{Tag::normal}; @@ -64,14 +59,14 @@ FermataShape FermataShape::empty() noexcept std::string_view FermataShape::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kFermataShapeWire[static_cast(m_tag)]; } bool FermataShape::tryParse(std::string_view text, FermataShape &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kFermataShapeWire); ++i) { - if (kWire[i] == text) + if (kFermataShapeWire[i] == text) { out = FermataShape{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Fifths.cpp b/src/private/mx/core/generated/Fifths.cpp index 228216172..2f30ff2bd 100644 --- a/src/private/mx/core/generated/Fifths.cpp +++ b/src/private/mx/core/generated/Fifths.cpp @@ -9,27 +9,22 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedFifths(int v) { return v; } -} // namespace - -Fifths::Fifths() : m_value{clamped(int{})} +Fifths::Fifths() : m_value{clampedFifths(int{})} { } -Fifths::Fifths(int value) : m_value{clamped(std::move(value))} +Fifths::Fifths(int value) : m_value{clampedFifths(std::move(value))} { } void Fifths::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedFifths(std::move(value)); } std::string Fifths::toString() const diff --git a/src/private/mx/core/generated/FontStyle.cpp b/src/private/mx/core/generated/FontStyle.cpp index ef1293302..807a94f3c 100644 --- a/src/private/mx/core/generated/FontStyle.cpp +++ b/src/private/mx/core/generated/FontStyle.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kFontStyleWire[] = { "normal", "italic", }; -} // namespace - FontStyle FontStyle::normal() noexcept { return FontStyle{Tag::normal}; @@ -30,14 +25,14 @@ FontStyle FontStyle::italic() noexcept std::string_view FontStyle::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kFontStyleWire[static_cast(m_tag)]; } bool FontStyle::tryParse(std::string_view text, FontStyle &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kFontStyleWire); ++i) { - if (kWire[i] == text) + if (kFontStyleWire[i] == text) { out = FontStyle{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/FontWeight.cpp b/src/private/mx/core/generated/FontWeight.cpp index 9c13e147b..7494bbbe7 100644 --- a/src/private/mx/core/generated/FontWeight.cpp +++ b/src/private/mx/core/generated/FontWeight.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kFontWeightWire[] = { "normal", "bold", }; -} // namespace - FontWeight FontWeight::normal() noexcept { return FontWeight{Tag::normal}; @@ -30,14 +25,14 @@ FontWeight FontWeight::bold() noexcept std::string_view FontWeight::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kFontWeightWire[static_cast(m_tag)]; } bool FontWeight::tryParse(std::string_view text, FontWeight &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kFontWeightWire); ++i) { - if (kWire[i] == text) + if (kFontWeightWire[i] == text) { out = FontWeight{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/GlassValue.cpp b/src/private/mx/core/generated/GlassValue.cpp index c3c757f30..766e25ab6 100644 --- a/src/private/mx/core/generated/GlassValue.cpp +++ b/src/private/mx/core/generated/GlassValue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kGlassValueWire[] = { "glass harmonica", "glass harp", "wind chimes", }; -} // namespace - GlassValue GlassValue::glassHarmonica() noexcept { return GlassValue{Tag::glassHarmonica}; @@ -36,14 +31,14 @@ GlassValue GlassValue::windChimes() noexcept std::string_view GlassValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kGlassValueWire[static_cast(m_tag)]; } bool GlassValue::tryParse(std::string_view text, GlassValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kGlassValueWire); ++i) { - if (kWire[i] == text) + if (kGlassValueWire[i] == text) { out = GlassValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/GlyphType.cpp b/src/private/mx/core/generated/GlyphType.cpp index b3ed954e9..5451037f3 100644 --- a/src/private/mx/core/generated/GlyphType.cpp +++ b/src/private/mx/core/generated/GlyphType.cpp @@ -7,23 +7,18 @@ namespace mx::core { -namespace -{ - -std::string repaired(std::string v) +std::string repairedGlyphType(std::string v) { return v; } -} // namespace - -GlyphType::GlyphType(std::string value) : m_value{repaired(std::move(value))} +GlyphType::GlyphType(std::string value) : m_value{repairedGlyphType(std::move(value))} { } void GlyphType::setValue(std::string value) { - m_value = repaired(std::move(value)); + m_value = repairedGlyphType(std::move(value)); } bool GlyphType::tryParse(std::string_view text, GlyphType &out) diff --git a/src/private/mx/core/generated/GroupBarlineValue.cpp b/src/private/mx/core/generated/GroupBarlineValue.cpp index eab55eb93..f729cf41c 100644 --- a/src/private/mx/core/generated/GroupBarlineValue.cpp +++ b/src/private/mx/core/generated/GroupBarlineValue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kGroupBarlineValueWire[] = { "yes", "no", "Mensurstrich", }; -} // namespace - GroupBarlineValue GroupBarlineValue::yes() noexcept { return GroupBarlineValue{Tag::yes}; @@ -36,14 +31,14 @@ GroupBarlineValue GroupBarlineValue::mensurstrich() noexcept std::string_view GroupBarlineValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kGroupBarlineValueWire[static_cast(m_tag)]; } bool GroupBarlineValue::tryParse(std::string_view text, GroupBarlineValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kGroupBarlineValueWire); ++i) { - if (kWire[i] == text) + if (kGroupBarlineValueWire[i] == text) { out = GroupBarlineValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/GroupSymbolValue.cpp b/src/private/mx/core/generated/GroupSymbolValue.cpp index b890c2985..c3c5d4b6d 100644 --- a/src/private/mx/core/generated/GroupSymbolValue.cpp +++ b/src/private/mx/core/generated/GroupSymbolValue.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kGroupSymbolValueWire[] = { "none", "brace", "line", "bracket", "square", }; -} // namespace - GroupSymbolValue GroupSymbolValue::none() noexcept { return GroupSymbolValue{Tag::none}; @@ -44,14 +39,14 @@ GroupSymbolValue GroupSymbolValue::square() noexcept std::string_view GroupSymbolValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kGroupSymbolValueWire[static_cast(m_tag)]; } bool GroupSymbolValue::tryParse(std::string_view text, GroupSymbolValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kGroupSymbolValueWire); ++i) { - if (kWire[i] == text) + if (kGroupSymbolValueWire[i] == text) { out = GroupSymbolValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/HandbellValue.cpp b/src/private/mx/core/generated/HandbellValue.cpp index 62b9817b5..d8b4051aa 100644 --- a/src/private/mx/core/generated/HandbellValue.cpp +++ b/src/private/mx/core/generated/HandbellValue.cpp @@ -8,10 +8,7 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kHandbellValueWire[] = { "belltree", "damp", "echo", @@ -26,8 +23,6 @@ constexpr std::string_view kWire[] = { "swing", }; -} // namespace - HandbellValue HandbellValue::belltree() noexcept { return HandbellValue{Tag::belltree}; @@ -90,14 +85,14 @@ HandbellValue HandbellValue::swing() noexcept std::string_view HandbellValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kHandbellValueWire[static_cast(m_tag)]; } bool HandbellValue::tryParse(std::string_view text, HandbellValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kHandbellValueWire); ++i) { - if (kWire[i] == text) + if (kHandbellValueWire[i] == text) { out = HandbellValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/HarmonClosedLocation.cpp b/src/private/mx/core/generated/HarmonClosedLocation.cpp index a3caa08f1..45de7e0f8 100644 --- a/src/private/mx/core/generated/HarmonClosedLocation.cpp +++ b/src/private/mx/core/generated/HarmonClosedLocation.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kHarmonClosedLocationWire[] = { "right", "bottom", "left", "top", }; -} // namespace - HarmonClosedLocation HarmonClosedLocation::right() noexcept { return HarmonClosedLocation{Tag::right}; @@ -42,14 +37,14 @@ HarmonClosedLocation HarmonClosedLocation::top() noexcept std::string_view HarmonClosedLocation::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kHarmonClosedLocationWire[static_cast(m_tag)]; } bool HarmonClosedLocation::tryParse(std::string_view text, HarmonClosedLocation &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kHarmonClosedLocationWire); ++i) { - if (kWire[i] == text) + if (kHarmonClosedLocationWire[i] == text) { out = HarmonClosedLocation{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/HarmonClosedValue.cpp b/src/private/mx/core/generated/HarmonClosedValue.cpp index 25bb85caf..c6f7afac6 100644 --- a/src/private/mx/core/generated/HarmonClosedValue.cpp +++ b/src/private/mx/core/generated/HarmonClosedValue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kHarmonClosedValueWire[] = { "yes", "no", "half", }; -} // namespace - HarmonClosedValue HarmonClosedValue::yes() noexcept { return HarmonClosedValue{Tag::yes}; @@ -36,14 +31,14 @@ HarmonClosedValue HarmonClosedValue::half() noexcept std::string_view HarmonClosedValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kHarmonClosedValueWire[static_cast(m_tag)]; } bool HarmonClosedValue::tryParse(std::string_view text, HarmonClosedValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kHarmonClosedValueWire); ++i) { - if (kWire[i] == text) + if (kHarmonClosedValueWire[i] == text) { out = HarmonClosedValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/HarmonyArrangement.cpp b/src/private/mx/core/generated/HarmonyArrangement.cpp index b6674133f..20aae3fc0 100644 --- a/src/private/mx/core/generated/HarmonyArrangement.cpp +++ b/src/private/mx/core/generated/HarmonyArrangement.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kHarmonyArrangementWire[] = { "vertical", "horizontal", "diagonal", }; -} // namespace - HarmonyArrangement HarmonyArrangement::vertical() noexcept { return HarmonyArrangement{Tag::vertical}; @@ -36,14 +31,14 @@ HarmonyArrangement HarmonyArrangement::diagonal() noexcept std::string_view HarmonyArrangement::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kHarmonyArrangementWire[static_cast(m_tag)]; } bool HarmonyArrangement::tryParse(std::string_view text, HarmonyArrangement &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kHarmonyArrangementWire); ++i) { - if (kWire[i] == text) + if (kHarmonyArrangementWire[i] == text) { out = HarmonyArrangement{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/HarmonyType.cpp b/src/private/mx/core/generated/HarmonyType.cpp index 85bd82ab8..cc18287cc 100644 --- a/src/private/mx/core/generated/HarmonyType.cpp +++ b/src/private/mx/core/generated/HarmonyType.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kHarmonyTypeWire[] = { "explicit", "implied", "alternate", }; -} // namespace - HarmonyType HarmonyType::explicit_() noexcept { return HarmonyType{Tag::explicit_}; @@ -36,14 +31,14 @@ HarmonyType HarmonyType::alternate() noexcept std::string_view HarmonyType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kHarmonyTypeWire[static_cast(m_tag)]; } bool HarmonyType::tryParse(std::string_view text, HarmonyType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kHarmonyTypeWire); ++i) { - if (kWire[i] == text) + if (kHarmonyTypeWire[i] == text) { out = HarmonyType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/HoleClosedLocation.cpp b/src/private/mx/core/generated/HoleClosedLocation.cpp index 29488af7a..41383ca0d 100644 --- a/src/private/mx/core/generated/HoleClosedLocation.cpp +++ b/src/private/mx/core/generated/HoleClosedLocation.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kHoleClosedLocationWire[] = { "right", "bottom", "left", "top", }; -} // namespace - HoleClosedLocation HoleClosedLocation::right() noexcept { return HoleClosedLocation{Tag::right}; @@ -42,14 +37,14 @@ HoleClosedLocation HoleClosedLocation::top() noexcept std::string_view HoleClosedLocation::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kHoleClosedLocationWire[static_cast(m_tag)]; } bool HoleClosedLocation::tryParse(std::string_view text, HoleClosedLocation &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kHoleClosedLocationWire); ++i) { - if (kWire[i] == text) + if (kHoleClosedLocationWire[i] == text) { out = HoleClosedLocation{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/HoleClosedValue.cpp b/src/private/mx/core/generated/HoleClosedValue.cpp index f0d2acc52..6d86cef50 100644 --- a/src/private/mx/core/generated/HoleClosedValue.cpp +++ b/src/private/mx/core/generated/HoleClosedValue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kHoleClosedValueWire[] = { "yes", "no", "half", }; -} // namespace - HoleClosedValue HoleClosedValue::yes() noexcept { return HoleClosedValue{Tag::yes}; @@ -36,14 +31,14 @@ HoleClosedValue HoleClosedValue::half() noexcept std::string_view HoleClosedValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kHoleClosedValueWire[static_cast(m_tag)]; } bool HoleClosedValue::tryParse(std::string_view text, HoleClosedValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kHoleClosedValueWire); ++i) { - if (kWire[i] == text) + if (kHoleClosedValueWire[i] == text) { out = HoleClosedValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/KindValue.cpp b/src/private/mx/core/generated/KindValue.cpp index 408d6f3e4..a679ded82 100644 --- a/src/private/mx/core/generated/KindValue.cpp +++ b/src/private/mx/core/generated/KindValue.cpp @@ -8,10 +8,7 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kKindValueWire[] = { "major", "minor", "augmented", @@ -47,8 +44,6 @@ constexpr std::string_view kWire[] = { "none", }; -} // namespace - KindValue KindValue::major() noexcept { return KindValue{Tag::major}; @@ -216,14 +211,14 @@ KindValue KindValue::none() noexcept std::string_view KindValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kKindValueWire[static_cast(m_tag)]; } bool KindValue::tryParse(std::string_view text, KindValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kKindValueWire); ++i) { - if (kWire[i] == text) + if (kKindValueWire[i] == text) { out = KindValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/LeftCenterRight.cpp b/src/private/mx/core/generated/LeftCenterRight.cpp index 3befcedd8..b171598e7 100644 --- a/src/private/mx/core/generated/LeftCenterRight.cpp +++ b/src/private/mx/core/generated/LeftCenterRight.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kLeftCenterRightWire[] = { "left", "center", "right", }; -} // namespace - LeftCenterRight LeftCenterRight::left() noexcept { return LeftCenterRight{Tag::left}; @@ -36,14 +31,14 @@ LeftCenterRight LeftCenterRight::right() noexcept std::string_view LeftCenterRight::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kLeftCenterRightWire[static_cast(m_tag)]; } bool LeftCenterRight::tryParse(std::string_view text, LeftCenterRight &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kLeftCenterRightWire); ++i) { - if (kWire[i] == text) + if (kLeftCenterRightWire[i] == text) { out = LeftCenterRight{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/LeftRight.cpp b/src/private/mx/core/generated/LeftRight.cpp index ec3008339..341a3c5db 100644 --- a/src/private/mx/core/generated/LeftRight.cpp +++ b/src/private/mx/core/generated/LeftRight.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kLeftRightWire[] = { "left", "right", }; -} // namespace - LeftRight LeftRight::left() noexcept { return LeftRight{Tag::left}; @@ -30,14 +25,14 @@ LeftRight LeftRight::right() noexcept std::string_view LeftRight::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kLeftRightWire[static_cast(m_tag)]; } bool LeftRight::tryParse(std::string_view text, LeftRight &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kLeftRightWire); ++i) { - if (kWire[i] == text) + if (kLeftRightWire[i] == text) { out = LeftRight{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/LineEnd.cpp b/src/private/mx/core/generated/LineEnd.cpp index d7136fece..89a16b59b 100644 --- a/src/private/mx/core/generated/LineEnd.cpp +++ b/src/private/mx/core/generated/LineEnd.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kLineEndWire[] = { "up", "down", "both", "arrow", "none", }; -} // namespace - LineEnd LineEnd::up() noexcept { return LineEnd{Tag::up}; @@ -44,14 +39,14 @@ LineEnd LineEnd::none() noexcept std::string_view LineEnd::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kLineEndWire[static_cast(m_tag)]; } bool LineEnd::tryParse(std::string_view text, LineEnd &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kLineEndWire); ++i) { - if (kWire[i] == text) + if (kLineEndWire[i] == text) { out = LineEnd{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/LineLength.cpp b/src/private/mx/core/generated/LineLength.cpp index abaef5d7c..3367d1f0b 100644 --- a/src/private/mx/core/generated/LineLength.cpp +++ b/src/private/mx/core/generated/LineLength.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kLineLengthWire[] = { "short", "medium", "long", }; -} // namespace - LineLength LineLength::short_() noexcept { return LineLength{Tag::short_}; @@ -36,14 +31,14 @@ LineLength LineLength::long_() noexcept std::string_view LineLength::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kLineLengthWire[static_cast(m_tag)]; } bool LineLength::tryParse(std::string_view text, LineLength &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kLineLengthWire); ++i) { - if (kWire[i] == text) + if (kLineLengthWire[i] == text) { out = LineLength{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/LineShape.cpp b/src/private/mx/core/generated/LineShape.cpp index 7d44de571..9b202405b 100644 --- a/src/private/mx/core/generated/LineShape.cpp +++ b/src/private/mx/core/generated/LineShape.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kLineShapeWire[] = { "straight", "curved", }; -} // namespace - LineShape LineShape::straight() noexcept { return LineShape{Tag::straight}; @@ -30,14 +25,14 @@ LineShape LineShape::curved() noexcept std::string_view LineShape::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kLineShapeWire[static_cast(m_tag)]; } bool LineShape::tryParse(std::string_view text, LineShape &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kLineShapeWire); ++i) { - if (kWire[i] == text) + if (kLineShapeWire[i] == text) { out = LineShape{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/LineType.cpp b/src/private/mx/core/generated/LineType.cpp index 0f56bbcf4..cd878b70b 100644 --- a/src/private/mx/core/generated/LineType.cpp +++ b/src/private/mx/core/generated/LineType.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kLineTypeWire[] = { "solid", "dashed", "dotted", "wavy", }; -} // namespace - LineType LineType::solid() noexcept { return LineType{Tag::solid}; @@ -42,14 +37,14 @@ LineType LineType::wavy() noexcept std::string_view LineType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kLineTypeWire[static_cast(m_tag)]; } bool LineType::tryParse(std::string_view text, LineType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kLineTypeWire); ++i) { - if (kWire[i] == text) + if (kLineTypeWire[i] == text) { out = LineType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/LineWidthType.cpp b/src/private/mx/core/generated/LineWidthType.cpp index cf8a0398c..3804343ae 100644 --- a/src/private/mx/core/generated/LineWidthType.cpp +++ b/src/private/mx/core/generated/LineWidthType.cpp @@ -7,23 +7,18 @@ namespace mx::core { -namespace -{ - -std::string repaired(std::string v) +std::string repairedLineWidthType(std::string v) { return v; } -} // namespace - -LineWidthType::LineWidthType(std::string value) : m_value{repaired(std::move(value))} +LineWidthType::LineWidthType(std::string value) : m_value{repairedLineWidthType(std::move(value))} { } void LineWidthType::setValue(std::string value) { - m_value = repaired(std::move(value)); + m_value = repairedLineWidthType(std::move(value)); } bool LineWidthType::tryParse(std::string_view text, LineWidthType &out) diff --git a/src/private/mx/core/generated/MIDI128.cpp b/src/private/mx/core/generated/MIDI128.cpp index 80fe75926..358e9fb7a 100644 --- a/src/private/mx/core/generated/MIDI128.cpp +++ b/src/private/mx/core/generated/MIDI128.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedMIDI128(int v) { if (v < 1) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -MIDI128::MIDI128() : m_value{clamped(int{})} +MIDI128::MIDI128() : m_value{clampedMIDI128(int{})} { } -MIDI128::MIDI128(int value) : m_value{clamped(std::move(value))} +MIDI128::MIDI128(int value) : m_value{clampedMIDI128(std::move(value))} { } void MIDI128::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedMIDI128(std::move(value)); } std::string MIDI128::toString() const diff --git a/src/private/mx/core/generated/MIDI16.cpp b/src/private/mx/core/generated/MIDI16.cpp index 1f477b9b6..74920b4a9 100644 --- a/src/private/mx/core/generated/MIDI16.cpp +++ b/src/private/mx/core/generated/MIDI16.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedMIDI16(int v) { if (v < 1) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -MIDI16::MIDI16() : m_value{clamped(int{})} +MIDI16::MIDI16() : m_value{clampedMIDI16(int{})} { } -MIDI16::MIDI16(int value) : m_value{clamped(std::move(value))} +MIDI16::MIDI16(int value) : m_value{clampedMIDI16(std::move(value))} { } void MIDI16::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedMIDI16(std::move(value)); } std::string MIDI16::toString() const diff --git a/src/private/mx/core/generated/MIDI16384.cpp b/src/private/mx/core/generated/MIDI16384.cpp index edc778cce..269a088c8 100644 --- a/src/private/mx/core/generated/MIDI16384.cpp +++ b/src/private/mx/core/generated/MIDI16384.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedMIDI16384(int v) { if (v < 1) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -MIDI16384::MIDI16384() : m_value{clamped(int{})} +MIDI16384::MIDI16384() : m_value{clampedMIDI16384(int{})} { } -MIDI16384::MIDI16384(int value) : m_value{clamped(std::move(value))} +MIDI16384::MIDI16384(int value) : m_value{clampedMIDI16384(std::move(value))} { } void MIDI16384::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedMIDI16384(std::move(value)); } std::string MIDI16384::toString() const diff --git a/src/private/mx/core/generated/MarginType.cpp b/src/private/mx/core/generated/MarginType.cpp index f9d590b69..5ad2f1386 100644 --- a/src/private/mx/core/generated/MarginType.cpp +++ b/src/private/mx/core/generated/MarginType.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kMarginTypeWire[] = { "odd", "even", "both", }; -} // namespace - MarginType MarginType::odd() noexcept { return MarginType{Tag::odd}; @@ -36,14 +31,14 @@ MarginType MarginType::both() noexcept std::string_view MarginType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kMarginTypeWire[static_cast(m_tag)]; } bool MarginType::tryParse(std::string_view text, MarginType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kMarginTypeWire); ++i) { - if (kWire[i] == text) + if (kMarginTypeWire[i] == text) { out = MarginType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/MeasureNumberingValue.cpp b/src/private/mx/core/generated/MeasureNumberingValue.cpp index afef73cd8..5d8b47b59 100644 --- a/src/private/mx/core/generated/MeasureNumberingValue.cpp +++ b/src/private/mx/core/generated/MeasureNumberingValue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kMeasureNumberingValueWire[] = { "none", "measure", "system", }; -} // namespace - MeasureNumberingValue MeasureNumberingValue::none() noexcept { return MeasureNumberingValue{Tag::none}; @@ -36,14 +31,14 @@ MeasureNumberingValue MeasureNumberingValue::system() noexcept std::string_view MeasureNumberingValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kMeasureNumberingValueWire[static_cast(m_tag)]; } bool MeasureNumberingValue::tryParse(std::string_view text, MeasureNumberingValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kMeasureNumberingValueWire); ++i) { - if (kWire[i] == text) + if (kMeasureNumberingValueWire[i] == text) { out = MeasureNumberingValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/MeasureText.cpp b/src/private/mx/core/generated/MeasureText.cpp index 4d9b21b4b..65b80f007 100644 --- a/src/private/mx/core/generated/MeasureText.cpp +++ b/src/private/mx/core/generated/MeasureText.cpp @@ -7,10 +7,7 @@ namespace mx::core { -namespace -{ - -std::string repaired(std::string v) +std::string repairedMeasureText(std::string v) { // Deterministic repair to the schema's minLength (plan ยง2.2.2): pad // with '-' so a too-short value is unrepresentable. @@ -21,19 +18,17 @@ std::string repaired(std::string v) return v; } -} // namespace - -MeasureText::MeasureText() : m_value{repaired(std::string{})} +MeasureText::MeasureText() : m_value{repairedMeasureText(std::string{})} { } -MeasureText::MeasureText(std::string value) : m_value{repaired(std::move(value))} +MeasureText::MeasureText(std::string value) : m_value{repairedMeasureText(std::move(value))} { } void MeasureText::setValue(std::string value) { - m_value = repaired(std::move(value)); + m_value = repairedMeasureText(std::move(value)); } bool MeasureText::tryParse(std::string_view text, MeasureText &out) diff --git a/src/private/mx/core/generated/MembraneValue.cpp b/src/private/mx/core/generated/MembraneValue.cpp index cdbadb874..8440bd772 100644 --- a/src/private/mx/core/generated/MembraneValue.cpp +++ b/src/private/mx/core/generated/MembraneValue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kMembraneValueWire[] = { "bass drum", "bass drum on side", "bongos", "Chinese tomtom", "conga drum", "cuica", "goblet drum", "Indo-American tomtom", "Japanese tomtom", "military drum", "snare drum", "snare drum snares off", "tabla", "tambourine", "tenor drum", "timbales", "tomtom", }; -} // namespace - MembraneValue MembraneValue::bassDrum() noexcept { return MembraneValue{Tag::bassDrum}; @@ -106,14 +101,14 @@ MembraneValue MembraneValue::tomtom() noexcept std::string_view MembraneValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kMembraneValueWire[static_cast(m_tag)]; } bool MembraneValue::tryParse(std::string_view text, MembraneValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kMembraneValueWire); ++i) { - if (kWire[i] == text) + if (kMembraneValueWire[i] == text) { out = MembraneValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/MetalValue.cpp b/src/private/mx/core/generated/MetalValue.cpp index a2648f2d8..3f1ee2b04 100644 --- a/src/private/mx/core/generated/MetalValue.cpp +++ b/src/private/mx/core/generated/MetalValue.cpp @@ -8,10 +8,7 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kMetalValueWire[] = { "agogo", "almglocken", "bell", @@ -46,8 +43,6 @@ constexpr std::string_view kWire[] = { "Vietnamese hat", }; -} // namespace - MetalValue MetalValue::agogo() noexcept { return MetalValue{Tag::agogo}; @@ -210,14 +205,14 @@ MetalValue MetalValue::vietnameseHat() noexcept std::string_view MetalValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kMetalValueWire[static_cast(m_tag)]; } bool MetalValue::tryParse(std::string_view text, MetalValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kMetalValueWire); ++i) { - if (kWire[i] == text) + if (kMetalValueWire[i] == text) { out = MetalValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Millimeters.cpp b/src/private/mx/core/generated/Millimeters.cpp index ad2c6d832..11edc688a 100644 --- a/src/private/mx/core/generated/Millimeters.cpp +++ b/src/private/mx/core/generated/Millimeters.cpp @@ -9,27 +9,22 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedMillimeters(Decimal v) { return v; } -} // namespace - -Millimeters::Millimeters() : m_value{clamped(Decimal{})} +Millimeters::Millimeters() : m_value{clampedMillimeters(Decimal{})} { } -Millimeters::Millimeters(Decimal value) : m_value{clamped(std::move(value))} +Millimeters::Millimeters(Decimal value) : m_value{clampedMillimeters(std::move(value))} { } void Millimeters::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedMillimeters(std::move(value)); } std::string Millimeters::toString() const diff --git a/src/private/mx/core/generated/Milliseconds.cpp b/src/private/mx/core/generated/Milliseconds.cpp index b5cb2df39..10d7e9e60 100644 --- a/src/private/mx/core/generated/Milliseconds.cpp +++ b/src/private/mx/core/generated/Milliseconds.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedMilliseconds(int v) { if (v < 0) { @@ -21,19 +18,17 @@ int clamped(int v) return v; } -} // namespace - -Milliseconds::Milliseconds() : m_value{clamped(int{})} +Milliseconds::Milliseconds() : m_value{clampedMilliseconds(int{})} { } -Milliseconds::Milliseconds(int value) : m_value{clamped(std::move(value))} +Milliseconds::Milliseconds(int value) : m_value{clampedMilliseconds(std::move(value))} { } void Milliseconds::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedMilliseconds(std::move(value)); } std::string Milliseconds::toString() const diff --git a/src/private/mx/core/generated/Mode.cpp b/src/private/mx/core/generated/Mode.cpp index 3d05674b6..937150740 100644 --- a/src/private/mx/core/generated/Mode.cpp +++ b/src/private/mx/core/generated/Mode.cpp @@ -7,23 +7,18 @@ namespace mx::core { -namespace -{ - -std::string repaired(std::string v) +std::string repairedMode(std::string v) { return v; } -} // namespace - -Mode::Mode(std::string value) : m_value{repaired(std::move(value))} +Mode::Mode(std::string value) : m_value{repairedMode(std::move(value))} { } void Mode::setValue(std::string value) { - m_value = repaired(std::move(value)); + m_value = repairedMode(std::move(value)); } bool Mode::tryParse(std::string_view text, Mode &out) diff --git a/src/private/mx/core/generated/Mute.cpp b/src/private/mx/core/generated/Mute.cpp index abc3f907a..e49dac800 100644 --- a/src/private/mx/core/generated/Mute.cpp +++ b/src/private/mx/core/generated/Mute.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kMuteWire[] = { "on", "off", "straight", "cup", "harmon-no-stem", "harmon-stem", "bucket", "plunger", "hat", "solotone", "practice", "stop-mute", "stop-hand", "echo", "palm", }; -} // namespace - Mute Mute::on() noexcept { return Mute{Tag::on}; @@ -95,14 +90,14 @@ Mute Mute::palm() noexcept std::string_view Mute::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kMuteWire[static_cast(m_tag)]; } bool Mute::tryParse(std::string_view text, Mute &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kMuteWire); ++i) { - if (kWire[i] == text) + if (kMuteWire[i] == text) { out = Mute{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/NonNegativeDecimal.cpp b/src/private/mx/core/generated/NonNegativeDecimal.cpp index 39d462782..c5e0374af 100644 --- a/src/private/mx/core/generated/NonNegativeDecimal.cpp +++ b/src/private/mx/core/generated/NonNegativeDecimal.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedNonNegativeDecimal(Decimal v) { if (v.value() < 0.0) { @@ -21,19 +18,17 @@ Decimal clamped(Decimal v) return v; } -} // namespace - -NonNegativeDecimal::NonNegativeDecimal() : m_value{clamped(Decimal{})} +NonNegativeDecimal::NonNegativeDecimal() : m_value{clampedNonNegativeDecimal(Decimal{})} { } -NonNegativeDecimal::NonNegativeDecimal(Decimal value) : m_value{clamped(std::move(value))} +NonNegativeDecimal::NonNegativeDecimal(Decimal value) : m_value{clampedNonNegativeDecimal(std::move(value))} { } void NonNegativeDecimal::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedNonNegativeDecimal(std::move(value)); } std::string NonNegativeDecimal::toString() const diff --git a/src/private/mx/core/generated/NoteSizeType.cpp b/src/private/mx/core/generated/NoteSizeType.cpp index 1d5c614f4..76201ab6a 100644 --- a/src/private/mx/core/generated/NoteSizeType.cpp +++ b/src/private/mx/core/generated/NoteSizeType.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kNoteSizeTypeWire[] = { "cue", "grace", "grace-cue", "large", }; -} // namespace - NoteSizeType NoteSizeType::cue() noexcept { return NoteSizeType{Tag::cue}; @@ -42,14 +37,14 @@ NoteSizeType NoteSizeType::large() noexcept std::string_view NoteSizeType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kNoteSizeTypeWire[static_cast(m_tag)]; } bool NoteSizeType::tryParse(std::string_view text, NoteSizeType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kNoteSizeTypeWire); ++i) { - if (kWire[i] == text) + if (kNoteSizeTypeWire[i] == text) { out = NoteSizeType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/NoteTypeValue.cpp b/src/private/mx/core/generated/NoteTypeValue.cpp index 64bea42be..a38615d1a 100644 --- a/src/private/mx/core/generated/NoteTypeValue.cpp +++ b/src/private/mx/core/generated/NoteTypeValue.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kNoteTypeValueWire[] = { "1024th", "512th", "256th", "128th", "64th", "32nd", "16th", "eighth", "quarter", "half", "whole", "breve", "long", "maxima", }; -} // namespace - NoteTypeValue NoteTypeValue::_1024th() noexcept { return NoteTypeValue{Tag::_1024th}; @@ -90,14 +85,14 @@ NoteTypeValue NoteTypeValue::maxima() noexcept std::string_view NoteTypeValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kNoteTypeValueWire[static_cast(m_tag)]; } bool NoteTypeValue::tryParse(std::string_view text, NoteTypeValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kNoteTypeValueWire); ++i) { - if (kWire[i] == text) + if (kNoteTypeValueWire[i] == text) { out = NoteTypeValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/NoteheadValue.cpp b/src/private/mx/core/generated/NoteheadValue.cpp index eca7ed58f..e46e5e08f 100644 --- a/src/private/mx/core/generated/NoteheadValue.cpp +++ b/src/private/mx/core/generated/NoteheadValue.cpp @@ -8,10 +8,7 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kNoteheadValueWire[] = { "slash", "triangle", "diamond", @@ -42,8 +39,6 @@ constexpr std::string_view kWire[] = { "other", }; -} // namespace - NoteheadValue NoteheadValue::slash() noexcept { return NoteheadValue{Tag::slash}; @@ -186,14 +181,14 @@ NoteheadValue NoteheadValue::other() noexcept std::string_view NoteheadValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kNoteheadValueWire[static_cast(m_tag)]; } bool NoteheadValue::tryParse(std::string_view text, NoteheadValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kNoteheadValueWire); ++i) { - if (kWire[i] == text) + if (kNoteheadValueWire[i] == text) { out = NoteheadValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/NumberLevel.cpp b/src/private/mx/core/generated/NumberLevel.cpp index f22a992fe..8318801f6 100644 --- a/src/private/mx/core/generated/NumberLevel.cpp +++ b/src/private/mx/core/generated/NumberLevel.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedNumberLevel(int v) { if (v < 1) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -NumberLevel::NumberLevel() : m_value{clamped(int{})} +NumberLevel::NumberLevel() : m_value{clampedNumberLevel(int{})} { } -NumberLevel::NumberLevel(int value) : m_value{clamped(std::move(value))} +NumberLevel::NumberLevel(int value) : m_value{clampedNumberLevel(std::move(value))} { } void NumberLevel::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedNumberLevel(std::move(value)); } std::string NumberLevel::toString() const diff --git a/src/private/mx/core/generated/NumberOfLines.cpp b/src/private/mx/core/generated/NumberOfLines.cpp index a3310a4b0..a270f127a 100644 --- a/src/private/mx/core/generated/NumberOfLines.cpp +++ b/src/private/mx/core/generated/NumberOfLines.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedNumberOfLines(int v) { if (v < 0) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -NumberOfLines::NumberOfLines() : m_value{clamped(int{})} +NumberOfLines::NumberOfLines() : m_value{clampedNumberOfLines(int{})} { } -NumberOfLines::NumberOfLines(int value) : m_value{clamped(std::move(value))} +NumberOfLines::NumberOfLines(int value) : m_value{clampedNumberOfLines(std::move(value))} { } void NumberOfLines::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedNumberOfLines(std::move(value)); } std::string NumberOfLines::toString() const diff --git a/src/private/mx/core/generated/NumeralMode.cpp b/src/private/mx/core/generated/NumeralMode.cpp index bfe364ecf..be73dabda 100644 --- a/src/private/mx/core/generated/NumeralMode.cpp +++ b/src/private/mx/core/generated/NumeralMode.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kNumeralModeWire[] = { "major", "minor", "natural minor", "melodic minor", "harmonic minor", }; -} // namespace - NumeralMode NumeralMode::major() noexcept { return NumeralMode{Tag::major}; @@ -44,14 +39,14 @@ NumeralMode NumeralMode::harmonicMinor() noexcept std::string_view NumeralMode::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kNumeralModeWire[static_cast(m_tag)]; } bool NumeralMode::tryParse(std::string_view text, NumeralMode &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kNumeralModeWire); ++i) { - if (kWire[i] == text) + if (kNumeralModeWire[i] == text) { out = NumeralMode{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/NumeralValue.cpp b/src/private/mx/core/generated/NumeralValue.cpp index 3b6aafa37..2355ff18c 100644 --- a/src/private/mx/core/generated/NumeralValue.cpp +++ b/src/private/mx/core/generated/NumeralValue.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedNumeralValue(int v) { if (v < 1) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -NumeralValue::NumeralValue() : m_value{clamped(int{})} +NumeralValue::NumeralValue() : m_value{clampedNumeralValue(int{})} { } -NumeralValue::NumeralValue(int value) : m_value{clamped(std::move(value))} +NumeralValue::NumeralValue(int value) : m_value{clampedNumeralValue(std::move(value))} { } void NumeralValue::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedNumeralValue(std::move(value)); } std::string NumeralValue::toString() const diff --git a/src/private/mx/core/generated/Octave.cpp b/src/private/mx/core/generated/Octave.cpp index 0f8fc16d8..2a6b34fd5 100644 --- a/src/private/mx/core/generated/Octave.cpp +++ b/src/private/mx/core/generated/Octave.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedOctave(int v) { if (v < 0) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -Octave::Octave() : m_value{clamped(int{})} +Octave::Octave() : m_value{clampedOctave(int{})} { } -Octave::Octave(int value) : m_value{clamped(std::move(value))} +Octave::Octave(int value) : m_value{clampedOctave(std::move(value))} { } void Octave::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedOctave(std::move(value)); } std::string Octave::toString() const diff --git a/src/private/mx/core/generated/OnOff.cpp b/src/private/mx/core/generated/OnOff.cpp index 1afea3cc1..ba5d4f34a 100644 --- a/src/private/mx/core/generated/OnOff.cpp +++ b/src/private/mx/core/generated/OnOff.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kOnOffWire[] = { "on", "off", }; -} // namespace - OnOff OnOff::on() noexcept { return OnOff{Tag::on}; @@ -30,14 +25,14 @@ OnOff OnOff::off() noexcept std::string_view OnOff::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kOnOffWire[static_cast(m_tag)]; } bool OnOff::tryParse(std::string_view text, OnOff &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kOnOffWire); ++i) { - if (kWire[i] == text) + if (kOnOffWire[i] == text) { out = OnOff{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/OverUnder.cpp b/src/private/mx/core/generated/OverUnder.cpp index 8fa3a20e1..9f37cc03e 100644 --- a/src/private/mx/core/generated/OverUnder.cpp +++ b/src/private/mx/core/generated/OverUnder.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kOverUnderWire[] = { "over", "under", }; -} // namespace - OverUnder OverUnder::over() noexcept { return OverUnder{Tag::over}; @@ -30,14 +25,14 @@ OverUnder OverUnder::under() noexcept std::string_view OverUnder::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kOverUnderWire[static_cast(m_tag)]; } bool OverUnder::tryParse(std::string_view text, OverUnder &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kOverUnderWire); ++i) { - if (kWire[i] == text) + if (kOverUnderWire[i] == text) { out = OverUnder{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/PedalType.cpp b/src/private/mx/core/generated/PedalType.cpp index f26fa78e3..00a5b5823 100644 --- a/src/private/mx/core/generated/PedalType.cpp +++ b/src/private/mx/core/generated/PedalType.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kPedalTypeWire[] = { "start", "stop", "sostenuto", "change", "continue", "discontinue", "resume", }; -} // namespace - PedalType PedalType::start() noexcept { return PedalType{Tag::start}; @@ -54,14 +49,14 @@ PedalType PedalType::resume() noexcept std::string_view PedalType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kPedalTypeWire[static_cast(m_tag)]; } bool PedalType::tryParse(std::string_view text, PedalType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kPedalTypeWire); ++i) { - if (kWire[i] == text) + if (kPedalTypeWire[i] == text) { out = PedalType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Percent.cpp b/src/private/mx/core/generated/Percent.cpp index 34a01ee60..524abe4fc 100644 --- a/src/private/mx/core/generated/Percent.cpp +++ b/src/private/mx/core/generated/Percent.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedPercent(Decimal v) { if (v.value() < 0.0) { @@ -25,19 +22,17 @@ Decimal clamped(Decimal v) return v; } -} // namespace - -Percent::Percent() : m_value{clamped(Decimal{})} +Percent::Percent() : m_value{clampedPercent(Decimal{})} { } -Percent::Percent(Decimal value) : m_value{clamped(std::move(value))} +Percent::Percent(Decimal value) : m_value{clampedPercent(std::move(value))} { } void Percent::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedPercent(std::move(value)); } std::string Percent::toString() const diff --git a/src/private/mx/core/generated/PitchedValue.cpp b/src/private/mx/core/generated/PitchedValue.cpp index 3da85f336..929c0b528 100644 --- a/src/private/mx/core/generated/PitchedValue.cpp +++ b/src/private/mx/core/generated/PitchedValue.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kPitchedValueWire[] = { "celesta", "chimes", "glockenspiel", "lithophone", "mallet", "marimba", "steel drums", "tubaphone", "tubular chimes", "vibraphone", "xylophone", }; -} // namespace - PitchedValue PitchedValue::celesta() noexcept { return PitchedValue{Tag::celesta}; @@ -75,14 +70,14 @@ PitchedValue PitchedValue::xylophone() noexcept std::string_view PitchedValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kPitchedValueWire[static_cast(m_tag)]; } bool PitchedValue::tryParse(std::string_view text, PitchedValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kPitchedValueWire); ++i) { - if (kWire[i] == text) + if (kPitchedValueWire[i] == text) { out = PitchedValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/PositiveDivisions.cpp b/src/private/mx/core/generated/PositiveDivisions.cpp index 1d71edf3d..73d5cfa66 100644 --- a/src/private/mx/core/generated/PositiveDivisions.cpp +++ b/src/private/mx/core/generated/PositiveDivisions.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedPositiveDivisions(Decimal v) { if (v.value() <= 0.0) { @@ -21,19 +18,17 @@ Decimal clamped(Decimal v) return v; } -} // namespace - -PositiveDivisions::PositiveDivisions() : m_value{clamped(Decimal{})} +PositiveDivisions::PositiveDivisions() : m_value{clampedPositiveDivisions(Decimal{})} { } -PositiveDivisions::PositiveDivisions(Decimal value) : m_value{clamped(std::move(value))} +PositiveDivisions::PositiveDivisions(Decimal value) : m_value{clampedPositiveDivisions(std::move(value))} { } void PositiveDivisions::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedPositiveDivisions(std::move(value)); } std::string PositiveDivisions::toString() const diff --git a/src/private/mx/core/generated/PrincipalVoiceSymbol.cpp b/src/private/mx/core/generated/PrincipalVoiceSymbol.cpp index 0d6b9506e..f360ac000 100644 --- a/src/private/mx/core/generated/PrincipalVoiceSymbol.cpp +++ b/src/private/mx/core/generated/PrincipalVoiceSymbol.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kPrincipalVoiceSymbolWire[] = { "Hauptstimme", "Nebenstimme", "plain", "none", }; -} // namespace - PrincipalVoiceSymbol PrincipalVoiceSymbol::hauptstimme() noexcept { return PrincipalVoiceSymbol{Tag::hauptstimme}; @@ -42,14 +37,14 @@ PrincipalVoiceSymbol PrincipalVoiceSymbol::none() noexcept std::string_view PrincipalVoiceSymbol::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kPrincipalVoiceSymbolWire[static_cast(m_tag)]; } bool PrincipalVoiceSymbol::tryParse(std::string_view text, PrincipalVoiceSymbol &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kPrincipalVoiceSymbolWire); ++i) { - if (kWire[i] == text) + if (kPrincipalVoiceSymbolWire[i] == text) { out = PrincipalVoiceSymbol{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/RightLeftMiddle.cpp b/src/private/mx/core/generated/RightLeftMiddle.cpp index 53c37b5a9..a73f7ffc1 100644 --- a/src/private/mx/core/generated/RightLeftMiddle.cpp +++ b/src/private/mx/core/generated/RightLeftMiddle.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kRightLeftMiddleWire[] = { "right", "left", "middle", }; -} // namespace - RightLeftMiddle RightLeftMiddle::right() noexcept { return RightLeftMiddle{Tag::right}; @@ -36,14 +31,14 @@ RightLeftMiddle RightLeftMiddle::middle() noexcept std::string_view RightLeftMiddle::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kRightLeftMiddleWire[static_cast(m_tag)]; } bool RightLeftMiddle::tryParse(std::string_view text, RightLeftMiddle &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kRightLeftMiddleWire); ++i) { - if (kWire[i] == text) + if (kRightLeftMiddleWire[i] == text) { out = RightLeftMiddle{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/RotationDegrees.cpp b/src/private/mx/core/generated/RotationDegrees.cpp index 6db69871c..a7f4dbd87 100644 --- a/src/private/mx/core/generated/RotationDegrees.cpp +++ b/src/private/mx/core/generated/RotationDegrees.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedRotationDegrees(Decimal v) { if (v.value() < -180.0) { @@ -25,19 +22,17 @@ Decimal clamped(Decimal v) return v; } -} // namespace - -RotationDegrees::RotationDegrees() : m_value{clamped(Decimal{})} +RotationDegrees::RotationDegrees() : m_value{clampedRotationDegrees(Decimal{})} { } -RotationDegrees::RotationDegrees(Decimal value) : m_value{clamped(std::move(value))} +RotationDegrees::RotationDegrees(Decimal value) : m_value{clampedRotationDegrees(std::move(value))} { } void RotationDegrees::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedRotationDegrees(std::move(value)); } std::string RotationDegrees::toString() const diff --git a/src/private/mx/core/generated/SemiPitched.cpp b/src/private/mx/core/generated/SemiPitched.cpp index 5fbe259e2..2a71be7aa 100644 --- a/src/private/mx/core/generated/SemiPitched.cpp +++ b/src/private/mx/core/generated/SemiPitched.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kSemiPitchedWire[] = { "high", "medium-high", "medium", "medium-low", "low", "very-low", }; -} // namespace - SemiPitched SemiPitched::high() noexcept { return SemiPitched{Tag::high}; @@ -49,14 +44,14 @@ SemiPitched SemiPitched::veryLow() noexcept std::string_view SemiPitched::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kSemiPitchedWire[static_cast(m_tag)]; } bool SemiPitched::tryParse(std::string_view text, SemiPitched &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kSemiPitchedWire); ++i) { - if (kWire[i] == text) + if (kSemiPitchedWire[i] == text) { out = SemiPitched{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Semitones.cpp b/src/private/mx/core/generated/Semitones.cpp index 54676e771..bb24a41af 100644 --- a/src/private/mx/core/generated/Semitones.cpp +++ b/src/private/mx/core/generated/Semitones.cpp @@ -9,27 +9,22 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedSemitones(Decimal v) { return v; } -} // namespace - -Semitones::Semitones() : m_value{clamped(Decimal{})} +Semitones::Semitones() : m_value{clampedSemitones(Decimal{})} { } -Semitones::Semitones(Decimal value) : m_value{clamped(std::move(value))} +Semitones::Semitones(Decimal value) : m_value{clampedSemitones(std::move(value))} { } void Semitones::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedSemitones(std::move(value)); } std::string Semitones::toString() const diff --git a/src/private/mx/core/generated/ShowFrets.cpp b/src/private/mx/core/generated/ShowFrets.cpp index ebe5b7ee9..73771b48d 100644 --- a/src/private/mx/core/generated/ShowFrets.cpp +++ b/src/private/mx/core/generated/ShowFrets.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kShowFretsWire[] = { "numbers", "letters", }; -} // namespace - ShowFrets ShowFrets::numbers() noexcept { return ShowFrets{Tag::numbers}; @@ -30,14 +25,14 @@ ShowFrets ShowFrets::letters() noexcept std::string_view ShowFrets::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kShowFretsWire[static_cast(m_tag)]; } bool ShowFrets::tryParse(std::string_view text, ShowFrets &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kShowFretsWire); ++i) { - if (kWire[i] == text) + if (kShowFretsWire[i] == text) { out = ShowFrets{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/ShowTuplet.cpp b/src/private/mx/core/generated/ShowTuplet.cpp index d35cda5a9..489a7d07b 100644 --- a/src/private/mx/core/generated/ShowTuplet.cpp +++ b/src/private/mx/core/generated/ShowTuplet.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kShowTupletWire[] = { "actual", "both", "none", }; -} // namespace - ShowTuplet ShowTuplet::actual() noexcept { return ShowTuplet{Tag::actual}; @@ -36,14 +31,14 @@ ShowTuplet ShowTuplet::none() noexcept std::string_view ShowTuplet::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kShowTupletWire[static_cast(m_tag)]; } bool ShowTuplet::tryParse(std::string_view text, ShowTuplet &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kShowTupletWire); ++i) { - if (kWire[i] == text) + if (kShowTupletWire[i] == text) { out = ShowTuplet{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/SmuflAccidentalGlyphName.cpp b/src/private/mx/core/generated/SmuflAccidentalGlyphName.cpp index 8a7596e94..b9d527615 100644 --- a/src/private/mx/core/generated/SmuflAccidentalGlyphName.cpp +++ b/src/private/mx/core/generated/SmuflAccidentalGlyphName.cpp @@ -9,22 +9,17 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kPrefix[] = { +constexpr std::string_view kSmuflAccidentalGlyphNamePrefix[] = { "acc", "medRenFla", "medRenNatura", "medRenShar", "kievanAccidental", }; // The ASCII subset of XML name characters the schema's \c denotes. -bool isNameChar(char c) noexcept +bool isNameCharSmuflAccidentalGlyphName(char c) noexcept { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '.' || c == ':' || c == '_'; } -} // namespace - SmuflAccidentalGlyphName::SmuflAccidentalGlyphName() { repair(); @@ -44,7 +39,7 @@ SmuflAccidentalGlyphName::SmuflAccidentalGlyphName(Prefix prefix, std::string su void SmuflAccidentalGlyphName::setPrefix(Prefix value) noexcept { m_prefix = value; - if (static_cast(m_prefix) >= std::size(kPrefix)) + if (static_cast(m_prefix) >= std::size(kSmuflAccidentalGlyphNamePrefix)) { m_prefix = Prefix::acc; } @@ -58,7 +53,7 @@ void SmuflAccidentalGlyphName::setSuffix(std::string value) void SmuflAccidentalGlyphName::repair() { - if (static_cast(m_prefix) >= std::size(kPrefix)) + if (static_cast(m_prefix) >= std::size(kSmuflAccidentalGlyphNamePrefix)) { m_prefix = Prefix::acc; } @@ -66,7 +61,7 @@ void SmuflAccidentalGlyphName::repair() cleaned.reserve(m_suffix.size()); for (const char c : m_suffix) { - if (isNameChar(c)) + if (isNameCharSmuflAccidentalGlyphName(c)) { cleaned.push_back(c); } @@ -80,16 +75,16 @@ void SmuflAccidentalGlyphName::repair() std::string SmuflAccidentalGlyphName::toString() const { - std::string out{kPrefix[static_cast(m_prefix)]}; + std::string out{kSmuflAccidentalGlyphNamePrefix[static_cast(m_prefix)]}; out += m_suffix; return out; } bool SmuflAccidentalGlyphName::tryParse(std::string_view text, SmuflAccidentalGlyphName &out) { - for (std::size_t i = 0; i < std::size(kPrefix); ++i) + for (std::size_t i = 0; i < std::size(kSmuflAccidentalGlyphNamePrefix); ++i) { - const std::string_view prefix = kPrefix[i]; + const std::string_view prefix = kSmuflAccidentalGlyphNamePrefix[i]; if (text.size() < prefix.size() || text.substr(0, prefix.size()) != prefix) { continue; @@ -102,7 +97,7 @@ bool SmuflAccidentalGlyphName::tryParse(std::string_view text, SmuflAccidentalGl bool valid = true; for (const char c : suffix) { - if (!isNameChar(c)) + if (!isNameCharSmuflAccidentalGlyphName(c)) { valid = false; break; diff --git a/src/private/mx/core/generated/SmuflCodaGlyphName.cpp b/src/private/mx/core/generated/SmuflCodaGlyphName.cpp index 6b0dae762..d3bd6e67b 100644 --- a/src/private/mx/core/generated/SmuflCodaGlyphName.cpp +++ b/src/private/mx/core/generated/SmuflCodaGlyphName.cpp @@ -9,22 +9,17 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kPrefix[] = { +constexpr std::string_view kSmuflCodaGlyphNamePrefix[] = { "coda", }; // The ASCII subset of XML name characters the schema's \c denotes. -bool isNameChar(char c) noexcept +bool isNameCharSmuflCodaGlyphName(char c) noexcept { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '.' || c == ':' || c == '_'; } -} // namespace - SmuflCodaGlyphName::SmuflCodaGlyphName() { repair(); @@ -47,7 +42,7 @@ void SmuflCodaGlyphName::repair() cleaned.reserve(m_suffix.size()); for (const char c : m_suffix) { - if (isNameChar(c)) + if (isNameCharSmuflCodaGlyphName(c)) { cleaned.push_back(c); } @@ -57,16 +52,16 @@ void SmuflCodaGlyphName::repair() std::string SmuflCodaGlyphName::toString() const { - std::string out{kPrefix[0]}; + std::string out{kSmuflCodaGlyphNamePrefix[0]}; out += m_suffix; return out; } bool SmuflCodaGlyphName::tryParse(std::string_view text, SmuflCodaGlyphName &out) { - for (std::size_t i = 0; i < std::size(kPrefix); ++i) + for (std::size_t i = 0; i < std::size(kSmuflCodaGlyphNamePrefix); ++i) { - const std::string_view prefix = kPrefix[i]; + const std::string_view prefix = kSmuflCodaGlyphNamePrefix[i]; if (text.size() < prefix.size() || text.substr(0, prefix.size()) != prefix) { continue; @@ -75,7 +70,7 @@ bool SmuflCodaGlyphName::tryParse(std::string_view text, SmuflCodaGlyphName &out bool valid = true; for (const char c : suffix) { - if (!isNameChar(c)) + if (!isNameCharSmuflCodaGlyphName(c)) { valid = false; break; diff --git a/src/private/mx/core/generated/SmuflLyricsGlyphName.cpp b/src/private/mx/core/generated/SmuflLyricsGlyphName.cpp index 3c98ef82b..913e9fef6 100644 --- a/src/private/mx/core/generated/SmuflLyricsGlyphName.cpp +++ b/src/private/mx/core/generated/SmuflLyricsGlyphName.cpp @@ -9,22 +9,17 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kPrefix[] = { +constexpr std::string_view kSmuflLyricsGlyphNamePrefix[] = { "lyrics", }; // The ASCII subset of XML name characters the schema's \c denotes. -bool isNameChar(char c) noexcept +bool isNameCharSmuflLyricsGlyphName(char c) noexcept { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '.' || c == ':' || c == '_'; } -} // namespace - SmuflLyricsGlyphName::SmuflLyricsGlyphName() { repair(); @@ -47,7 +42,7 @@ void SmuflLyricsGlyphName::repair() cleaned.reserve(m_suffix.size()); for (const char c : m_suffix) { - if (isNameChar(c)) + if (isNameCharSmuflLyricsGlyphName(c)) { cleaned.push_back(c); } @@ -61,16 +56,16 @@ void SmuflLyricsGlyphName::repair() std::string SmuflLyricsGlyphName::toString() const { - std::string out{kPrefix[0]}; + std::string out{kSmuflLyricsGlyphNamePrefix[0]}; out += m_suffix; return out; } bool SmuflLyricsGlyphName::tryParse(std::string_view text, SmuflLyricsGlyphName &out) { - for (std::size_t i = 0; i < std::size(kPrefix); ++i) + for (std::size_t i = 0; i < std::size(kSmuflLyricsGlyphNamePrefix); ++i) { - const std::string_view prefix = kPrefix[i]; + const std::string_view prefix = kSmuflLyricsGlyphNamePrefix[i]; if (text.size() < prefix.size() || text.substr(0, prefix.size()) != prefix) { continue; @@ -83,7 +78,7 @@ bool SmuflLyricsGlyphName::tryParse(std::string_view text, SmuflLyricsGlyphName bool valid = true; for (const char c : suffix) { - if (!isNameChar(c)) + if (!isNameCharSmuflLyricsGlyphName(c)) { valid = false; break; diff --git a/src/private/mx/core/generated/SmuflPictogramGlyphName.cpp b/src/private/mx/core/generated/SmuflPictogramGlyphName.cpp index 60084aaf1..a71955a29 100644 --- a/src/private/mx/core/generated/SmuflPictogramGlyphName.cpp +++ b/src/private/mx/core/generated/SmuflPictogramGlyphName.cpp @@ -9,22 +9,17 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kPrefix[] = { +constexpr std::string_view kSmuflPictogramGlyphNamePrefix[] = { "pict", }; // The ASCII subset of XML name characters the schema's \c denotes. -bool isNameChar(char c) noexcept +bool isNameCharSmuflPictogramGlyphName(char c) noexcept { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '.' || c == ':' || c == '_'; } -} // namespace - SmuflPictogramGlyphName::SmuflPictogramGlyphName() { repair(); @@ -47,7 +42,7 @@ void SmuflPictogramGlyphName::repair() cleaned.reserve(m_suffix.size()); for (const char c : m_suffix) { - if (isNameChar(c)) + if (isNameCharSmuflPictogramGlyphName(c)) { cleaned.push_back(c); } @@ -61,16 +56,16 @@ void SmuflPictogramGlyphName::repair() std::string SmuflPictogramGlyphName::toString() const { - std::string out{kPrefix[0]}; + std::string out{kSmuflPictogramGlyphNamePrefix[0]}; out += m_suffix; return out; } bool SmuflPictogramGlyphName::tryParse(std::string_view text, SmuflPictogramGlyphName &out) { - for (std::size_t i = 0; i < std::size(kPrefix); ++i) + for (std::size_t i = 0; i < std::size(kSmuflPictogramGlyphNamePrefix); ++i) { - const std::string_view prefix = kPrefix[i]; + const std::string_view prefix = kSmuflPictogramGlyphNamePrefix[i]; if (text.size() < prefix.size() || text.substr(0, prefix.size()) != prefix) { continue; @@ -83,7 +78,7 @@ bool SmuflPictogramGlyphName::tryParse(std::string_view text, SmuflPictogramGlyp bool valid = true; for (const char c : suffix) { - if (!isNameChar(c)) + if (!isNameCharSmuflPictogramGlyphName(c)) { valid = false; break; diff --git a/src/private/mx/core/generated/SmuflSegnoGlyphName.cpp b/src/private/mx/core/generated/SmuflSegnoGlyphName.cpp index 225e02e90..88db3505e 100644 --- a/src/private/mx/core/generated/SmuflSegnoGlyphName.cpp +++ b/src/private/mx/core/generated/SmuflSegnoGlyphName.cpp @@ -9,22 +9,17 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kPrefix[] = { +constexpr std::string_view kSmuflSegnoGlyphNamePrefix[] = { "segno", }; // The ASCII subset of XML name characters the schema's \c denotes. -bool isNameChar(char c) noexcept +bool isNameCharSmuflSegnoGlyphName(char c) noexcept { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '.' || c == ':' || c == '_'; } -} // namespace - SmuflSegnoGlyphName::SmuflSegnoGlyphName() { repair(); @@ -47,7 +42,7 @@ void SmuflSegnoGlyphName::repair() cleaned.reserve(m_suffix.size()); for (const char c : m_suffix) { - if (isNameChar(c)) + if (isNameCharSmuflSegnoGlyphName(c)) { cleaned.push_back(c); } @@ -57,16 +52,16 @@ void SmuflSegnoGlyphName::repair() std::string SmuflSegnoGlyphName::toString() const { - std::string out{kPrefix[0]}; + std::string out{kSmuflSegnoGlyphNamePrefix[0]}; out += m_suffix; return out; } bool SmuflSegnoGlyphName::tryParse(std::string_view text, SmuflSegnoGlyphName &out) { - for (std::size_t i = 0; i < std::size(kPrefix); ++i) + for (std::size_t i = 0; i < std::size(kSmuflSegnoGlyphNamePrefix); ++i) { - const std::string_view prefix = kPrefix[i]; + const std::string_view prefix = kSmuflSegnoGlyphNamePrefix[i]; if (text.size() < prefix.size() || text.substr(0, prefix.size()) != prefix) { continue; @@ -75,7 +70,7 @@ bool SmuflSegnoGlyphName::tryParse(std::string_view text, SmuflSegnoGlyphName &o bool valid = true; for (const char c : suffix) { - if (!isNameChar(c)) + if (!isNameCharSmuflSegnoGlyphName(c)) { valid = false; break; diff --git a/src/private/mx/core/generated/SoundID.cpp b/src/private/mx/core/generated/SoundID.cpp index 80ce21f79..9bc2d2dda 100644 --- a/src/private/mx/core/generated/SoundID.cpp +++ b/src/private/mx/core/generated/SoundID.cpp @@ -8,10 +8,7 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kSoundIDWire[] = { "brass.alphorn", "brass.alto-horn", "brass.baritone-horn", @@ -908,8 +905,6 @@ constexpr std::string_view kWire[] = { "wood.wood-block", }; -} // namespace - SoundID SoundID::brassAlphorn() noexcept { return SoundID{Tag::brassAlphorn}; @@ -5382,14 +5377,14 @@ SoundID SoundID::woodWoodBlock() noexcept std::string_view SoundID::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kSoundIDWire[static_cast(m_tag)]; } bool SoundID::tryParse(std::string_view text, SoundID &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kSoundIDWire); ++i) { - if (kWire[i] == text) + if (kSoundIDWire[i] == text) { out = SoundID{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StaffDivideSymbol.cpp b/src/private/mx/core/generated/StaffDivideSymbol.cpp index 78d2b1bcf..89ca86e9d 100644 --- a/src/private/mx/core/generated/StaffDivideSymbol.cpp +++ b/src/private/mx/core/generated/StaffDivideSymbol.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStaffDivideSymbolWire[] = { "down", "up", "up-down", }; -} // namespace - StaffDivideSymbol StaffDivideSymbol::down() noexcept { return StaffDivideSymbol{Tag::down}; @@ -36,14 +31,14 @@ StaffDivideSymbol StaffDivideSymbol::upDown() noexcept std::string_view StaffDivideSymbol::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStaffDivideSymbolWire[static_cast(m_tag)]; } bool StaffDivideSymbol::tryParse(std::string_view text, StaffDivideSymbol &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStaffDivideSymbolWire); ++i) { - if (kWire[i] == text) + if (kStaffDivideSymbolWire[i] == text) { out = StaffDivideSymbol{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StaffLine.cpp b/src/private/mx/core/generated/StaffLine.cpp index 5201c770d..c17ac0c51 100644 --- a/src/private/mx/core/generated/StaffLine.cpp +++ b/src/private/mx/core/generated/StaffLine.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedStaffLine(int v) { if (v < 1) { @@ -21,19 +18,17 @@ int clamped(int v) return v; } -} // namespace - -StaffLine::StaffLine() : m_value{clamped(int{})} +StaffLine::StaffLine() : m_value{clampedStaffLine(int{})} { } -StaffLine::StaffLine(int value) : m_value{clamped(std::move(value))} +StaffLine::StaffLine(int value) : m_value{clampedStaffLine(std::move(value))} { } void StaffLine::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedStaffLine(std::move(value)); } std::string StaffLine::toString() const diff --git a/src/private/mx/core/generated/StaffLinePosition.cpp b/src/private/mx/core/generated/StaffLinePosition.cpp index d75a790e2..82b39c163 100644 --- a/src/private/mx/core/generated/StaffLinePosition.cpp +++ b/src/private/mx/core/generated/StaffLinePosition.cpp @@ -9,27 +9,22 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedStaffLinePosition(int v) { return v; } -} // namespace - -StaffLinePosition::StaffLinePosition() : m_value{clamped(int{})} +StaffLinePosition::StaffLinePosition() : m_value{clampedStaffLinePosition(int{})} { } -StaffLinePosition::StaffLinePosition(int value) : m_value{clamped(std::move(value))} +StaffLinePosition::StaffLinePosition(int value) : m_value{clampedStaffLinePosition(std::move(value))} { } void StaffLinePosition::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedStaffLinePosition(std::move(value)); } std::string StaffLinePosition::toString() const diff --git a/src/private/mx/core/generated/StaffNumber.cpp b/src/private/mx/core/generated/StaffNumber.cpp index 951faddc5..5d2d57915 100644 --- a/src/private/mx/core/generated/StaffNumber.cpp +++ b/src/private/mx/core/generated/StaffNumber.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedStaffNumber(int v) { if (v < 1) { @@ -21,19 +18,17 @@ int clamped(int v) return v; } -} // namespace - -StaffNumber::StaffNumber() : m_value{clamped(int{})} +StaffNumber::StaffNumber() : m_value{clampedStaffNumber(int{})} { } -StaffNumber::StaffNumber(int value) : m_value{clamped(std::move(value))} +StaffNumber::StaffNumber(int value) : m_value{clampedStaffNumber(std::move(value))} { } void StaffNumber::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedStaffNumber(std::move(value)); } std::string StaffNumber::toString() const diff --git a/src/private/mx/core/generated/StaffType.cpp b/src/private/mx/core/generated/StaffType.cpp index 1af23749c..da8283bdd 100644 --- a/src/private/mx/core/generated/StaffType.cpp +++ b/src/private/mx/core/generated/StaffType.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStaffTypeWire[] = { "ossia", "editorial", "cue", "alternate", "regular", }; -} // namespace - StaffType StaffType::ossia() noexcept { return StaffType{Tag::ossia}; @@ -44,14 +39,14 @@ StaffType StaffType::regular() noexcept std::string_view StaffType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStaffTypeWire[static_cast(m_tag)]; } bool StaffType::tryParse(std::string_view text, StaffType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStaffTypeWire); ++i) { - if (kWire[i] == text) + if (kStaffTypeWire[i] == text) { out = StaffType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StartNote.cpp b/src/private/mx/core/generated/StartNote.cpp index bd07a0661..fd7048699 100644 --- a/src/private/mx/core/generated/StartNote.cpp +++ b/src/private/mx/core/generated/StartNote.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStartNoteWire[] = { "upper", "main", "below", }; -} // namespace - StartNote StartNote::upper() noexcept { return StartNote{Tag::upper}; @@ -36,14 +31,14 @@ StartNote StartNote::below() noexcept std::string_view StartNote::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStartNoteWire[static_cast(m_tag)]; } bool StartNote::tryParse(std::string_view text, StartNote &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStartNoteWire); ++i) { - if (kWire[i] == text) + if (kStartNoteWire[i] == text) { out = StartNote{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StartStop.cpp b/src/private/mx/core/generated/StartStop.cpp index 1f8e4d49f..90d747e7e 100644 --- a/src/private/mx/core/generated/StartStop.cpp +++ b/src/private/mx/core/generated/StartStop.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStartStopWire[] = { "start", "stop", }; -} // namespace - StartStop StartStop::start() noexcept { return StartStop{Tag::start}; @@ -30,14 +25,14 @@ StartStop StartStop::stop() noexcept std::string_view StartStop::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStartStopWire[static_cast(m_tag)]; } bool StartStop::tryParse(std::string_view text, StartStop &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStartStopWire); ++i) { - if (kWire[i] == text) + if (kStartStopWire[i] == text) { out = StartStop{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StartStopContinue.cpp b/src/private/mx/core/generated/StartStopContinue.cpp index 5881a6e38..c07bf1b16 100644 --- a/src/private/mx/core/generated/StartStopContinue.cpp +++ b/src/private/mx/core/generated/StartStopContinue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStartStopContinueWire[] = { "start", "stop", "continue", }; -} // namespace - StartStopContinue StartStopContinue::start() noexcept { return StartStopContinue{Tag::start}; @@ -36,14 +31,14 @@ StartStopContinue StartStopContinue::continue_() noexcept std::string_view StartStopContinue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStartStopContinueWire[static_cast(m_tag)]; } bool StartStopContinue::tryParse(std::string_view text, StartStopContinue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStartStopContinueWire); ++i) { - if (kWire[i] == text) + if (kStartStopContinueWire[i] == text) { out = StartStopContinue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StartStopDiscontinue.cpp b/src/private/mx/core/generated/StartStopDiscontinue.cpp index 4b72f2f6f..b45e6beb2 100644 --- a/src/private/mx/core/generated/StartStopDiscontinue.cpp +++ b/src/private/mx/core/generated/StartStopDiscontinue.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStartStopDiscontinueWire[] = { "start", "stop", "discontinue", }; -} // namespace - StartStopDiscontinue StartStopDiscontinue::start() noexcept { return StartStopDiscontinue{Tag::start}; @@ -36,14 +31,14 @@ StartStopDiscontinue StartStopDiscontinue::discontinue() noexcept std::string_view StartStopDiscontinue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStartStopDiscontinueWire[static_cast(m_tag)]; } bool StartStopDiscontinue::tryParse(std::string_view text, StartStopDiscontinue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStartStopDiscontinueWire); ++i) { - if (kWire[i] == text) + if (kStartStopDiscontinueWire[i] == text) { out = StartStopDiscontinue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StartStopSingle.cpp b/src/private/mx/core/generated/StartStopSingle.cpp index 6bbf0aa0d..751a864bc 100644 --- a/src/private/mx/core/generated/StartStopSingle.cpp +++ b/src/private/mx/core/generated/StartStopSingle.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStartStopSingleWire[] = { "start", "stop", "single", }; -} // namespace - StartStopSingle StartStopSingle::start() noexcept { return StartStopSingle{Tag::start}; @@ -36,14 +31,14 @@ StartStopSingle StartStopSingle::single() noexcept std::string_view StartStopSingle::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStartStopSingleWire[static_cast(m_tag)]; } bool StartStopSingle::tryParse(std::string_view text, StartStopSingle &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStartStopSingleWire); ++i) { - if (kWire[i] == text) + if (kStartStopSingleWire[i] == text) { out = StartStopSingle{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StemValue.cpp b/src/private/mx/core/generated/StemValue.cpp index c9dd08d71..3053694e8 100644 --- a/src/private/mx/core/generated/StemValue.cpp +++ b/src/private/mx/core/generated/StemValue.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStemValueWire[] = { "down", "up", "double", "none", }; -} // namespace - StemValue StemValue::down() noexcept { return StemValue{Tag::down}; @@ -42,14 +37,14 @@ StemValue StemValue::none() noexcept std::string_view StemValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStemValueWire[static_cast(m_tag)]; } bool StemValue::tryParse(std::string_view text, StemValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStemValueWire); ++i) { - if (kWire[i] == text) + if (kStemValueWire[i] == text) { out = StemValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Step.cpp b/src/private/mx/core/generated/Step.cpp index 18083cc74..1eb1dea67 100644 --- a/src/private/mx/core/generated/Step.cpp +++ b/src/private/mx/core/generated/Step.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStepWire[] = { "A", "B", "C", "D", "E", "F", "G", }; -} // namespace - Step Step::a() noexcept { return Step{Tag::a}; @@ -54,14 +49,14 @@ Step Step::g() noexcept std::string_view Step::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStepWire[static_cast(m_tag)]; } bool Step::tryParse(std::string_view text, Step &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStepWire); ++i) { - if (kWire[i] == text) + if (kStepWire[i] == text) { out = Step{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StickLocation.cpp b/src/private/mx/core/generated/StickLocation.cpp index 8fe78e8a3..23956ba76 100644 --- a/src/private/mx/core/generated/StickLocation.cpp +++ b/src/private/mx/core/generated/StickLocation.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStickLocationWire[] = { "center", "rim", "cymbal bell", "cymbal edge", }; -} // namespace - StickLocation StickLocation::center() noexcept { return StickLocation{Tag::center}; @@ -42,14 +37,14 @@ StickLocation StickLocation::cymbalEdge() noexcept std::string_view StickLocation::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStickLocationWire[static_cast(m_tag)]; } bool StickLocation::tryParse(std::string_view text, StickLocation &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStickLocationWire); ++i) { - if (kWire[i] == text) + if (kStickLocationWire[i] == text) { out = StickLocation{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StickMaterial.cpp b/src/private/mx/core/generated/StickMaterial.cpp index 5a013c2ed..4bcf2667c 100644 --- a/src/private/mx/core/generated/StickMaterial.cpp +++ b/src/private/mx/core/generated/StickMaterial.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStickMaterialWire[] = { "soft", "medium", "hard", "shaded", "x", }; -} // namespace - StickMaterial StickMaterial::soft() noexcept { return StickMaterial{Tag::soft}; @@ -44,14 +39,14 @@ StickMaterial StickMaterial::x() noexcept std::string_view StickMaterial::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStickMaterialWire[static_cast(m_tag)]; } bool StickMaterial::tryParse(std::string_view text, StickMaterial &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStickMaterialWire); ++i) { - if (kWire[i] == text) + if (kStickMaterialWire[i] == text) { out = StickMaterial{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StickType.cpp b/src/private/mx/core/generated/StickType.cpp index 481f5018b..94f1f751c 100644 --- a/src/private/mx/core/generated/StickType.cpp +++ b/src/private/mx/core/generated/StickType.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kStickTypeWire[] = { "bass drum", "double bass drum", "glockenspiel", "gum", "hammer", "superball", "timpani", "wound", "xylophone", "yarn", }; -} // namespace - StickType StickType::bassDrum() noexcept { return StickType{Tag::bassDrum}; @@ -70,14 +65,14 @@ StickType StickType::yarn() noexcept std::string_view StickType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kStickTypeWire[static_cast(m_tag)]; } bool StickType::tryParse(std::string_view text, StickType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kStickTypeWire); ++i) { - if (kWire[i] == text) + if (kStickTypeWire[i] == text) { out = StickType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/StringNumber.cpp b/src/private/mx/core/generated/StringNumber.cpp index 773e68ecb..687823e62 100644 --- a/src/private/mx/core/generated/StringNumber.cpp +++ b/src/private/mx/core/generated/StringNumber.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedStringNumber(int v) { if (v < 1) { @@ -21,19 +18,17 @@ int clamped(int v) return v; } -} // namespace - -StringNumber::StringNumber() : m_value{clamped(int{})} +StringNumber::StringNumber() : m_value{clampedStringNumber(int{})} { } -StringNumber::StringNumber(int value) : m_value{clamped(std::move(value))} +StringNumber::StringNumber(int value) : m_value{clampedStringNumber(std::move(value))} { } void StringNumber::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedStringNumber(std::move(value)); } std::string StringNumber::toString() const diff --git a/src/private/mx/core/generated/SwingTypeValue.cpp b/src/private/mx/core/generated/SwingTypeValue.cpp index 1d0f9b028..a325aeb91 100644 --- a/src/private/mx/core/generated/SwingTypeValue.cpp +++ b/src/private/mx/core/generated/SwingTypeValue.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kSwingTypeValueWire[] = { "16th", "eighth", }; -} // namespace - SwingTypeValue SwingTypeValue::_16th() noexcept { return SwingTypeValue{Tag::_16th}; @@ -30,14 +25,14 @@ SwingTypeValue SwingTypeValue::eighth() noexcept std::string_view SwingTypeValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kSwingTypeValueWire[static_cast(m_tag)]; } bool SwingTypeValue::tryParse(std::string_view text, SwingTypeValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kSwingTypeValueWire); ++i) { - if (kWire[i] == text) + if (kSwingTypeValueWire[i] == text) { out = SwingTypeValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Syllabic.cpp b/src/private/mx/core/generated/Syllabic.cpp index e13c8c438..1481a215d 100644 --- a/src/private/mx/core/generated/Syllabic.cpp +++ b/src/private/mx/core/generated/Syllabic.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kSyllabicWire[] = { "single", "begin", "end", "middle", }; -} // namespace - Syllabic Syllabic::single() noexcept { return Syllabic{Tag::single}; @@ -42,14 +37,14 @@ Syllabic Syllabic::middle() noexcept std::string_view Syllabic::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kSyllabicWire[static_cast(m_tag)]; } bool Syllabic::tryParse(std::string_view text, Syllabic &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kSyllabicWire); ++i) { - if (kWire[i] == text) + if (kSyllabicWire[i] == text) { out = Syllabic{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/SymbolSize.cpp b/src/private/mx/core/generated/SymbolSize.cpp index 02543030b..775e29cb9 100644 --- a/src/private/mx/core/generated/SymbolSize.cpp +++ b/src/private/mx/core/generated/SymbolSize.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kSymbolSizeWire[] = { "full", "cue", "grace-cue", "large", }; -} // namespace - SymbolSize SymbolSize::full() noexcept { return SymbolSize{Tag::full}; @@ -42,14 +37,14 @@ SymbolSize SymbolSize::large() noexcept std::string_view SymbolSize::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kSymbolSizeWire[static_cast(m_tag)]; } bool SymbolSize::tryParse(std::string_view text, SymbolSize &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kSymbolSizeWire); ++i) { - if (kWire[i] == text) + if (kSymbolSizeWire[i] == text) { out = SymbolSize{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/SyncType.cpp b/src/private/mx/core/generated/SyncType.cpp index 2cdcc8132..06672cb25 100644 --- a/src/private/mx/core/generated/SyncType.cpp +++ b/src/private/mx/core/generated/SyncType.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kSyncTypeWire[] = { "none", "tempo", "mostly-tempo", "mostly-event", "event", "always-event", }; -} // namespace - SyncType SyncType::none() noexcept { return SyncType{Tag::none}; @@ -49,14 +44,14 @@ SyncType SyncType::alwaysEvent() noexcept std::string_view SyncType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kSyncTypeWire[static_cast(m_tag)]; } bool SyncType::tryParse(std::string_view text, SyncType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kSyncTypeWire); ++i) { - if (kWire[i] == text) + if (kSyncTypeWire[i] == text) { out = SyncType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/SystemRelation.cpp b/src/private/mx/core/generated/SystemRelation.cpp index 3228d6a81..ed7c0b9e1 100644 --- a/src/private/mx/core/generated/SystemRelation.cpp +++ b/src/private/mx/core/generated/SystemRelation.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kSystemRelationWire[] = { "only-top", "also-top", "none", }; -} // namespace - SystemRelation SystemRelation::onlyTop() noexcept { return SystemRelation{Tag::onlyTop}; @@ -36,14 +31,14 @@ SystemRelation SystemRelation::none() noexcept std::string_view SystemRelation::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kSystemRelationWire[static_cast(m_tag)]; } bool SystemRelation::tryParse(std::string_view text, SystemRelation &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kSystemRelationWire); ++i) { - if (kWire[i] == text) + if (kSystemRelationWire[i] == text) { out = SystemRelation{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/SystemRelationNumber.cpp b/src/private/mx/core/generated/SystemRelationNumber.cpp index c74dd99c0..0b6beb5d3 100644 --- a/src/private/mx/core/generated/SystemRelationNumber.cpp +++ b/src/private/mx/core/generated/SystemRelationNumber.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kSystemRelationNumberWire[] = { "only-top", "only-bottom", "also-top", "also-bottom", "none", }; -} // namespace - SystemRelationNumber SystemRelationNumber::onlyTop() noexcept { return SystemRelationNumber{Tag::onlyTop}; @@ -44,14 +39,14 @@ SystemRelationNumber SystemRelationNumber::none() noexcept std::string_view SystemRelationNumber::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kSystemRelationNumberWire[static_cast(m_tag)]; } bool SystemRelationNumber::tryParse(std::string_view text, SystemRelationNumber &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kSystemRelationNumberWire); ++i) { - if (kWire[i] == text) + if (kSystemRelationNumberWire[i] == text) { out = SystemRelationNumber{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TapHand.cpp b/src/private/mx/core/generated/TapHand.cpp index 13b3ea056..af037e044 100644 --- a/src/private/mx/core/generated/TapHand.cpp +++ b/src/private/mx/core/generated/TapHand.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTapHandWire[] = { "left", "right", }; -} // namespace - TapHand TapHand::left() noexcept { return TapHand{Tag::left}; @@ -30,14 +25,14 @@ TapHand TapHand::right() noexcept std::string_view TapHand::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTapHandWire[static_cast(m_tag)]; } bool TapHand::tryParse(std::string_view text, TapHand &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTapHandWire); ++i) { - if (kWire[i] == text) + if (kTapHandWire[i] == text) { out = TapHand{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Tenths.cpp b/src/private/mx/core/generated/Tenths.cpp index d8b46d3c4..aedf464d3 100644 --- a/src/private/mx/core/generated/Tenths.cpp +++ b/src/private/mx/core/generated/Tenths.cpp @@ -9,27 +9,22 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedTenths(Decimal v) { return v; } -} // namespace - -Tenths::Tenths() : m_value{clamped(Decimal{})} +Tenths::Tenths() : m_value{clampedTenths(Decimal{})} { } -Tenths::Tenths(Decimal value) : m_value{clamped(std::move(value))} +Tenths::Tenths(Decimal value) : m_value{clampedTenths(std::move(value))} { } void Tenths::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedTenths(std::move(value)); } std::string Tenths::toString() const diff --git a/src/private/mx/core/generated/TextDirection.cpp b/src/private/mx/core/generated/TextDirection.cpp index 19ba1f6f6..d3a342904 100644 --- a/src/private/mx/core/generated/TextDirection.cpp +++ b/src/private/mx/core/generated/TextDirection.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTextDirectionWire[] = { "ltr", "rtl", "lro", "rlo", }; -} // namespace - TextDirection TextDirection::ltr() noexcept { return TextDirection{Tag::ltr}; @@ -42,14 +37,14 @@ TextDirection TextDirection::rlo() noexcept std::string_view TextDirection::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTextDirectionWire[static_cast(m_tag)]; } bool TextDirection::tryParse(std::string_view text, TextDirection &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTextDirectionWire); ++i) { - if (kWire[i] == text) + if (kTextDirectionWire[i] == text) { out = TextDirection{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TiedType.cpp b/src/private/mx/core/generated/TiedType.cpp index c64c702dc..08a915432 100644 --- a/src/private/mx/core/generated/TiedType.cpp +++ b/src/private/mx/core/generated/TiedType.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTiedTypeWire[] = { "start", "stop", "continue", "let-ring", }; -} // namespace - TiedType TiedType::start() noexcept { return TiedType{Tag::start}; @@ -42,14 +37,14 @@ TiedType TiedType::letRing() noexcept std::string_view TiedType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTiedTypeWire[static_cast(m_tag)]; } bool TiedType::tryParse(std::string_view text, TiedType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTiedTypeWire); ++i) { - if (kWire[i] == text) + if (kTiedTypeWire[i] == text) { out = TiedType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TimeRelation.cpp b/src/private/mx/core/generated/TimeRelation.cpp index f9e1ffa31..1f24a71bb 100644 --- a/src/private/mx/core/generated/TimeRelation.cpp +++ b/src/private/mx/core/generated/TimeRelation.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTimeRelationWire[] = { "parentheses", "bracket", "equals", "slash", "space", "hyphen", }; -} // namespace - TimeRelation TimeRelation::parentheses() noexcept { return TimeRelation{Tag::parentheses}; @@ -49,14 +44,14 @@ TimeRelation TimeRelation::hyphen() noexcept std::string_view TimeRelation::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTimeRelationWire[static_cast(m_tag)]; } bool TimeRelation::tryParse(std::string_view text, TimeRelation &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTimeRelationWire); ++i) { - if (kWire[i] == text) + if (kTimeRelationWire[i] == text) { out = TimeRelation{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TimeSeparator.cpp b/src/private/mx/core/generated/TimeSeparator.cpp index ee33468e4..686fc0de0 100644 --- a/src/private/mx/core/generated/TimeSeparator.cpp +++ b/src/private/mx/core/generated/TimeSeparator.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTimeSeparatorWire[] = { "none", "horizontal", "diagonal", "vertical", "adjacent", }; -} // namespace - TimeSeparator TimeSeparator::none() noexcept { return TimeSeparator{Tag::none}; @@ -44,14 +39,14 @@ TimeSeparator TimeSeparator::adjacent() noexcept std::string_view TimeSeparator::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTimeSeparatorWire[static_cast(m_tag)]; } bool TimeSeparator::tryParse(std::string_view text, TimeSeparator &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTimeSeparatorWire); ++i) { - if (kWire[i] == text) + if (kTimeSeparatorWire[i] == text) { out = TimeSeparator{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TimeSymbol.cpp b/src/private/mx/core/generated/TimeSymbol.cpp index b17bb1b7e..186461b64 100644 --- a/src/private/mx/core/generated/TimeSymbol.cpp +++ b/src/private/mx/core/generated/TimeSymbol.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTimeSymbolWire[] = { "common", "cut", "single-number", "note", "dotted-note", "normal", }; -} // namespace - TimeSymbol TimeSymbol::common() noexcept { return TimeSymbol{Tag::common}; @@ -49,14 +44,14 @@ TimeSymbol TimeSymbol::normal() noexcept std::string_view TimeSymbol::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTimeSymbolWire[static_cast(m_tag)]; } bool TimeSymbol::tryParse(std::string_view text, TimeSymbol &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTimeSymbolWire); ++i) { - if (kWire[i] == text) + if (kTimeSymbolWire[i] == text) { out = TimeSymbol{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TipDirection.cpp b/src/private/mx/core/generated/TipDirection.cpp index a084d486f..3fa0859c9 100644 --- a/src/private/mx/core/generated/TipDirection.cpp +++ b/src/private/mx/core/generated/TipDirection.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTipDirectionWire[] = { "up", "down", "left", "right", "northwest", "northeast", "southeast", "southwest", }; -} // namespace - TipDirection TipDirection::up() noexcept { return TipDirection{Tag::up}; @@ -59,14 +54,14 @@ TipDirection TipDirection::southwest() noexcept std::string_view TipDirection::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTipDirectionWire[static_cast(m_tag)]; } bool TipDirection::tryParse(std::string_view text, TipDirection &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTipDirectionWire); ++i) { - if (kWire[i] == text) + if (kTipDirectionWire[i] == text) { out = TipDirection{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TopBottom.cpp b/src/private/mx/core/generated/TopBottom.cpp index c60aa6aa8..476639779 100644 --- a/src/private/mx/core/generated/TopBottom.cpp +++ b/src/private/mx/core/generated/TopBottom.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTopBottomWire[] = { "top", "bottom", }; -} // namespace - TopBottom TopBottom::top() noexcept { return TopBottom{Tag::top}; @@ -30,14 +25,14 @@ TopBottom TopBottom::bottom() noexcept std::string_view TopBottom::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTopBottomWire[static_cast(m_tag)]; } bool TopBottom::tryParse(std::string_view text, TopBottom &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTopBottomWire); ++i) { - if (kWire[i] == text) + if (kTopBottomWire[i] == text) { out = TopBottom{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TremoloMarks.cpp b/src/private/mx/core/generated/TremoloMarks.cpp index 741c4b397..c46c301ae 100644 --- a/src/private/mx/core/generated/TremoloMarks.cpp +++ b/src/private/mx/core/generated/TremoloMarks.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -int clamped(int v) +int clampedTremoloMarks(int v) { if (v < 0) { @@ -25,19 +22,17 @@ int clamped(int v) return v; } -} // namespace - -TremoloMarks::TremoloMarks() : m_value{clamped(int{})} +TremoloMarks::TremoloMarks() : m_value{clampedTremoloMarks(int{})} { } -TremoloMarks::TremoloMarks(int value) : m_value{clamped(std::move(value))} +TremoloMarks::TremoloMarks(int value) : m_value{clampedTremoloMarks(std::move(value))} { } void TremoloMarks::setValue(int value) { - m_value = clamped(std::move(value)); + m_value = clampedTremoloMarks(std::move(value)); } std::string TremoloMarks::toString() const diff --git a/src/private/mx/core/generated/TremoloType.cpp b/src/private/mx/core/generated/TremoloType.cpp index e542d6cab..d0e969fcc 100644 --- a/src/private/mx/core/generated/TremoloType.cpp +++ b/src/private/mx/core/generated/TremoloType.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTremoloTypeWire[] = { "start", "stop", "single", "unmeasured", }; -} // namespace - TremoloType TremoloType::start() noexcept { return TremoloType{Tag::start}; @@ -42,14 +37,14 @@ TremoloType TremoloType::unmeasured() noexcept std::string_view TremoloType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTremoloTypeWire[static_cast(m_tag)]; } bool TremoloType::tryParse(std::string_view text, TremoloType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTremoloTypeWire); ++i) { - if (kWire[i] == text) + if (kTremoloTypeWire[i] == text) { out = TremoloType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TrillBeats.cpp b/src/private/mx/core/generated/TrillBeats.cpp index 470270cfe..36b1e76f8 100644 --- a/src/private/mx/core/generated/TrillBeats.cpp +++ b/src/private/mx/core/generated/TrillBeats.cpp @@ -9,10 +9,7 @@ namespace mx::core { -namespace -{ - -Decimal clamped(Decimal v) +Decimal clampedTrillBeats(Decimal v) { if (v.value() < 2.0) { @@ -21,19 +18,17 @@ Decimal clamped(Decimal v) return v; } -} // namespace - -TrillBeats::TrillBeats() : m_value{clamped(Decimal{})} +TrillBeats::TrillBeats() : m_value{clampedTrillBeats(Decimal{})} { } -TrillBeats::TrillBeats(Decimal value) : m_value{clamped(std::move(value))} +TrillBeats::TrillBeats(Decimal value) : m_value{clampedTrillBeats(std::move(value))} { } void TrillBeats::setValue(Decimal value) { - m_value = clamped(std::move(value)); + m_value = clampedTrillBeats(std::move(value)); } std::string TrillBeats::toString() const diff --git a/src/private/mx/core/generated/TrillStep.cpp b/src/private/mx/core/generated/TrillStep.cpp index 6782073d6..02537b28e 100644 --- a/src/private/mx/core/generated/TrillStep.cpp +++ b/src/private/mx/core/generated/TrillStep.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTrillStepWire[] = { "whole", "half", "unison", }; -} // namespace - TrillStep TrillStep::whole() noexcept { return TrillStep{Tag::whole}; @@ -36,14 +31,14 @@ TrillStep TrillStep::unison() noexcept std::string_view TrillStep::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTrillStepWire[static_cast(m_tag)]; } bool TrillStep::tryParse(std::string_view text, TrillStep &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTrillStepWire); ++i) { - if (kWire[i] == text) + if (kTrillStepWire[i] == text) { out = TrillStep{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/TwoNoteTurn.cpp b/src/private/mx/core/generated/TwoNoteTurn.cpp index ae5281555..4768f8459 100644 --- a/src/private/mx/core/generated/TwoNoteTurn.cpp +++ b/src/private/mx/core/generated/TwoNoteTurn.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kTwoNoteTurnWire[] = { "whole", "half", "none", }; -} // namespace - TwoNoteTurn TwoNoteTurn::whole() noexcept { return TwoNoteTurn{Tag::whole}; @@ -36,14 +31,14 @@ TwoNoteTurn TwoNoteTurn::none() noexcept std::string_view TwoNoteTurn::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kTwoNoteTurnWire[static_cast(m_tag)]; } bool TwoNoteTurn::tryParse(std::string_view text, TwoNoteTurn &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kTwoNoteTurnWire); ++i) { - if (kWire[i] == text) + if (kTwoNoteTurnWire[i] == text) { out = TwoNoteTurn{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/UpDown.cpp b/src/private/mx/core/generated/UpDown.cpp index 34b7e549b..411a68e32 100644 --- a/src/private/mx/core/generated/UpDown.cpp +++ b/src/private/mx/core/generated/UpDown.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kUpDownWire[] = { "up", "down", }; -} // namespace - UpDown UpDown::up() noexcept { return UpDown{Tag::up}; @@ -30,14 +25,14 @@ UpDown UpDown::down() noexcept std::string_view UpDown::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kUpDownWire[static_cast(m_tag)]; } bool UpDown::tryParse(std::string_view text, UpDown &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kUpDownWire); ++i) { - if (kWire[i] == text) + if (kUpDownWire[i] == text) { out = UpDown{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/UpDownStopContinue.cpp b/src/private/mx/core/generated/UpDownStopContinue.cpp index 488c52615..eec3a75ad 100644 --- a/src/private/mx/core/generated/UpDownStopContinue.cpp +++ b/src/private/mx/core/generated/UpDownStopContinue.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kUpDownStopContinueWire[] = { "up", "down", "stop", "continue", }; -} // namespace - UpDownStopContinue UpDownStopContinue::up() noexcept { return UpDownStopContinue{Tag::up}; @@ -42,14 +37,14 @@ UpDownStopContinue UpDownStopContinue::continue_() noexcept std::string_view UpDownStopContinue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kUpDownStopContinueWire[static_cast(m_tag)]; } bool UpDownStopContinue::tryParse(std::string_view text, UpDownStopContinue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kUpDownStopContinueWire); ++i) { - if (kWire[i] == text) + if (kUpDownStopContinueWire[i] == text) { out = UpDownStopContinue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/UprightInverted.cpp b/src/private/mx/core/generated/UprightInverted.cpp index d914d6e19..ba42097de 100644 --- a/src/private/mx/core/generated/UprightInverted.cpp +++ b/src/private/mx/core/generated/UprightInverted.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kUprightInvertedWire[] = { "upright", "inverted", }; -} // namespace - UprightInverted UprightInverted::upright() noexcept { return UprightInverted{Tag::upright}; @@ -30,14 +25,14 @@ UprightInverted UprightInverted::inverted() noexcept std::string_view UprightInverted::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kUprightInvertedWire[static_cast(m_tag)]; } bool UprightInverted::tryParse(std::string_view text, UprightInverted &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kUprightInvertedWire); ++i) { - if (kWire[i] == text) + if (kUprightInvertedWire[i] == text) { out = UprightInverted{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Valign.cpp b/src/private/mx/core/generated/Valign.cpp index e33c40480..66cadc7d0 100644 --- a/src/private/mx/core/generated/Valign.cpp +++ b/src/private/mx/core/generated/Valign.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kValignWire[] = { "top", "middle", "bottom", "baseline", }; -} // namespace - Valign Valign::top() noexcept { return Valign{Tag::top}; @@ -42,14 +37,14 @@ Valign Valign::baseline() noexcept std::string_view Valign::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kValignWire[static_cast(m_tag)]; } bool Valign::tryParse(std::string_view text, Valign &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kValignWire); ++i) { - if (kWire[i] == text) + if (kValignWire[i] == text) { out = Valign{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/ValignImage.cpp b/src/private/mx/core/generated/ValignImage.cpp index bb548f099..94cc287d0 100644 --- a/src/private/mx/core/generated/ValignImage.cpp +++ b/src/private/mx/core/generated/ValignImage.cpp @@ -8,17 +8,12 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kValignImageWire[] = { "top", "middle", "bottom", }; -} // namespace - ValignImage ValignImage::top() noexcept { return ValignImage{Tag::top}; @@ -36,14 +31,14 @@ ValignImage ValignImage::bottom() noexcept std::string_view ValignImage::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kValignImageWire[static_cast(m_tag)]; } bool ValignImage::tryParse(std::string_view text, ValignImage &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kValignImageWire); ++i) { - if (kWire[i] == text) + if (kValignImageWire[i] == text) { out = ValignImage{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/WedgeType.cpp b/src/private/mx/core/generated/WedgeType.cpp index f400e6a9d..16d431dc7 100644 --- a/src/private/mx/core/generated/WedgeType.cpp +++ b/src/private/mx/core/generated/WedgeType.cpp @@ -8,18 +8,13 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kWedgeTypeWire[] = { "crescendo", "diminuendo", "stop", "continue", }; -} // namespace - WedgeType WedgeType::crescendo() noexcept { return WedgeType{Tag::crescendo}; @@ -42,14 +37,14 @@ WedgeType WedgeType::continue_() noexcept std::string_view WedgeType::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kWedgeTypeWire[static_cast(m_tag)]; } bool WedgeType::tryParse(std::string_view text, WedgeType &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kWedgeTypeWire); ++i) { - if (kWire[i] == text) + if (kWedgeTypeWire[i] == text) { out = WedgeType{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/Winged.cpp b/src/private/mx/core/generated/Winged.cpp index 91a95cf70..7db6bdc18 100644 --- a/src/private/mx/core/generated/Winged.cpp +++ b/src/private/mx/core/generated/Winged.cpp @@ -8,15 +8,10 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kWingedWire[] = { "none", "straight", "curved", "double-straight", "double-curved", }; -} // namespace - Winged Winged::none() noexcept { return Winged{Tag::none}; @@ -44,14 +39,14 @@ Winged Winged::doubleCurved() noexcept std::string_view Winged::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kWingedWire[static_cast(m_tag)]; } bool Winged::tryParse(std::string_view text, Winged &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kWingedWire); ++i) { - if (kWire[i] == text) + if (kWingedWire[i] == text) { out = Winged{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/WoodValue.cpp b/src/private/mx/core/generated/WoodValue.cpp index 6fbdd6e9e..957a0f370 100644 --- a/src/private/mx/core/generated/WoodValue.cpp +++ b/src/private/mx/core/generated/WoodValue.cpp @@ -8,10 +8,7 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kWoodValueWire[] = { "bamboo scraper", "board clapper", "cabasa", "castanets", "castanets with handle", "claves", "football rattle", "guiro", "log drum", "maraca", "maracas", "quijada", "rainstick", "ratchet", "reco-reco", @@ -19,8 +16,6 @@ constexpr std::string_view kWire[] = { "wood block", }; -} // namespace - WoodValue WoodValue::bambooScraper() noexcept { return WoodValue{Tag::bambooScraper}; @@ -128,14 +123,14 @@ WoodValue WoodValue::woodBlock() noexcept std::string_view WoodValue::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kWoodValueWire[static_cast(m_tag)]; } bool WoodValue::tryParse(std::string_view text, WoodValue &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kWoodValueWire); ++i) { - if (kWire[i] == text) + if (kWoodValueWire[i] == text) { out = WoodValue{static_cast(i)}; return true; diff --git a/src/private/mx/core/generated/YesNo.cpp b/src/private/mx/core/generated/YesNo.cpp index 39a01c257..2b3bceb94 100644 --- a/src/private/mx/core/generated/YesNo.cpp +++ b/src/private/mx/core/generated/YesNo.cpp @@ -8,16 +8,11 @@ namespace mx::core { -namespace -{ - -constexpr std::string_view kWire[] = { +constexpr std::string_view kYesNoWire[] = { "yes", "no", }; -} // namespace - YesNo YesNo::yes() noexcept { return YesNo{Tag::yes}; @@ -30,14 +25,14 @@ YesNo YesNo::no() noexcept std::string_view YesNo::toString() const noexcept { - return kWire[static_cast(m_tag)]; + return kYesNoWire[static_cast(m_tag)]; } bool YesNo::tryParse(std::string_view text, YesNo &out) noexcept { - for (std::size_t i = 0; i < std::size(kWire); ++i) + for (std::size_t i = 0; i < std::size(kYesNoWire); ++i) { - if (kWire[i] == text) + if (kYesNoWire[i] == text) { out = YesNo{static_cast(i)}; return true;