-
Notifications
You must be signed in to change notification settings - Fork 35
feat: model editorial (footnote/level) in mx::api #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
webern
wants to merge
1
commit into
claude/issue-204-plan-vsvcas
from
claude/issue-204-editorial-vsvcas
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // MusicXML Class Library | ||
| // Copyright (c) by Matthew James Briggs | ||
| // Distributed under the MIT License | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "mx/api/ApiCommon.h" | ||
| #include "mx/api/FootnoteData.h" | ||
| #include "mx/api/LevelData.h" | ||
|
|
||
| namespace mx | ||
| { | ||
| namespace api | ||
| { | ||
| // The MusicXML editorial group (<footnote> + <level>) carries editorial information for a parent | ||
| // element. It appears on several elements (e.g. <part-group>, <direction>); this reusable type | ||
| // captures it once. The is...Specified flags distinguish "absent" (write nothing back) from a | ||
| // present-but-empty child. | ||
| class EditorialData | ||
| { | ||
| public: | ||
| bool isFootnoteSpecified; | ||
| FootnoteData footnote; | ||
| bool isLevelSpecified; | ||
| LevelData level; | ||
|
|
||
| EditorialData() : isFootnoteSpecified{false}, footnote{}, isLevelSpecified{false}, level{} | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| MXAPI_EQUALS_BEGIN(EditorialData) | ||
| MXAPI_EQUALS_MEMBER(isFootnoteSpecified) | ||
| MXAPI_EQUALS_MEMBER(footnote) | ||
| MXAPI_EQUALS_MEMBER(isLevelSpecified) | ||
| MXAPI_EQUALS_MEMBER(level) | ||
| MXAPI_EQUALS_END; | ||
| MXAPI_NOT_EQUALS_AND_VECTORS(EditorialData); | ||
| } // namespace api | ||
| } // namespace mx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // MusicXML Class Library | ||
| // Copyright (c) by Matthew James Briggs | ||
| // Distributed under the MIT License | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "mx/api/ApiCommon.h" | ||
| #include "mx/api/ColorData.h" | ||
| #include "mx/api/FontData.h" | ||
| #include "mx/api/PositionData.h" | ||
|
|
||
| #include <string> | ||
|
|
||
| namespace mx | ||
| { | ||
| namespace api | ||
| { | ||
| // The MusicXML <footnote> element is a formatted-text: text content plus the position, font, and | ||
| // color attribute groups. Modeled to match WordsData (the api's other formatted-text surface). | ||
| class FootnoteData | ||
| { | ||
| public: | ||
| std::string text; | ||
| PositionData positionData; | ||
| FontData fontData; | ||
| bool isColorSpecified; | ||
| ColorData colorData; | ||
|
|
||
| FootnoteData() : text{}, positionData{}, fontData{}, isColorSpecified{false}, colorData{} | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| MXAPI_EQUALS_BEGIN(FootnoteData) | ||
| MXAPI_EQUALS_MEMBER(text) | ||
| MXAPI_EQUALS_MEMBER(positionData) | ||
| MXAPI_EQUALS_MEMBER(fontData) | ||
| MXAPI_EQUALS_MEMBER(isColorSpecified) | ||
| MXAPI_EQUALS_MEMBER(colorData) | ||
| MXAPI_EQUALS_END; | ||
| MXAPI_NOT_EQUALS_AND_VECTORS(FootnoteData); | ||
| } // namespace api | ||
| } // namespace mx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // MusicXML Class Library | ||
| // Copyright (c) by Matthew James Briggs | ||
| // Distributed under the MIT License | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "mx/api/ApiCommon.h" | ||
|
|
||
| #include <string> | ||
|
|
||
| namespace mx | ||
| { | ||
| namespace api | ||
| { | ||
| // Mirrors the MusicXML <level> 'type' attribute (start-stop-single): whether the editorial | ||
| // information applies to the start of a series of symbols, the end, or a single symbol. | ||
| enum class StartStopSingle | ||
| { | ||
| unspecified, | ||
| start, | ||
| stop, | ||
| single | ||
| }; | ||
|
|
||
| // Mirrors the MusicXML <level> 'size' attribute (symbol-size). | ||
| enum class SymbolSize | ||
| { | ||
| unspecified, | ||
| full, | ||
| cue, | ||
| graceCue, | ||
| large | ||
| }; | ||
|
|
||
| // The MusicXML <level> element specifies editorial information for the parent element. Its text | ||
| // content is descriptive; the attributes control how the editorial marking is rendered. An | ||
| // `unspecified` enum (or empty `value`) means the source carried no such attribute and none is | ||
| // written back. | ||
| class LevelData | ||
| { | ||
| public: | ||
| std::string value; | ||
| Bool reference; | ||
| StartStopSingle type; | ||
| Bool parentheses; | ||
| Bool bracket; | ||
| SymbolSize size; | ||
|
|
||
| LevelData() | ||
| : value{}, reference{Bool::unspecified}, type{StartStopSingle::unspecified}, parentheses{Bool::unspecified}, | ||
| bracket{Bool::unspecified}, size{SymbolSize::unspecified} | ||
| { | ||
| } | ||
| }; | ||
|
|
||
| MXAPI_EQUALS_BEGIN(LevelData) | ||
| MXAPI_EQUALS_MEMBER(value) | ||
| MXAPI_EQUALS_MEMBER(reference) | ||
| MXAPI_EQUALS_MEMBER(type) | ||
| MXAPI_EQUALS_MEMBER(parentheses) | ||
| MXAPI_EQUALS_MEMBER(bracket) | ||
| MXAPI_EQUALS_MEMBER(size) | ||
| MXAPI_EQUALS_END; | ||
| MXAPI_NOT_EQUALS_AND_VECTORS(LevelData); | ||
| } // namespace api | ||
| } // namespace mx | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This strikes me as one of things we should try to simplify in the
mx::apimodel instead of mirroring the way MusicXML models it. In general, we are trying to get away from MusicXML's procedural "stop"/"start" semantics (i.e. requiring stateful parsing) and represent data more statically whenever we can.