dn-m / MusicXML

Implementation of the musicXML specification in Swift
MIT License
74 stars 20 forks source link

[Model] Refactor Attributes out of Measure #3

Closed jsbean closed 5 years ago

jsbean commented 5 years ago

Currently, Measure contains an array of Attribute values. The Attribute values are not actually applicable to a Measure specifically, but can be defined at any point (incl. mid-measure).

Instead, model Measure around these parameters:

<!ATTLIST measure
    number CDATA #REQUIRED
    text CDATA #IMPLIED
    implicit %yes-no; #IMPLIED
    non-controlling %yes-no; #IMPLIED
    width %tenths; #IMPLIED
    %optional-unique-id;
>
jsbean commented 5 years ago

Thus, the Measure protocol from #2 could look like this:

protocol Measure {
    var number: Int { get }
    var text: String? { get }
    var implicit: Bool { get }
    var nonControlling: Bool { get }
    var width: Int { get }
    var id: String? { get }
}