MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::others::Measure Class Reference

Represents the attributes of a measure. More...

#include <Others.h>

+ Inheritance diagram for musx::dom::others::Measure:

Public Types

enum class  PositioningType {
  Manual , TimeSignature , BeatChart , TimeSigPlusPositioning ,
  BeatChartPlusPositioning
}
 Positioning (music spacing) type for the measure. More...
 
enum class  BarlineType {
  None , OptionsDefault , Normal , Double ,
  Final , Solid , Dashed , Tick ,
  Custom
}
 Barline type for left and right barlines. More...
 
enum class  ShowKeySigMode { IfNeeded , Always , Never }
 How and whether to show a Key Signature in this measure. More...
 
enum class  ShowTimeSigMode { IfNeeded , Always , Never }
 How and whether to show a Time Signature in this measure. More...
 
- Public Types inherited from musx::dom::Base
enum class  ShareMode { All , Partial , None }
 Describes how this instance is shared between part and score. More...
 
using SharedNodes = std::set< std::string >
 The container type for shared nodes.
 

Public Member Functions

 Measure (const DocumentWeakPtr &document, Cmper measureId, ShareMode shareMode, Cmper cmper)
 Constructor function.
 
bool calcShouldShowFullNames () const
 Calculates if a measure should show full names vs. abbreviated names.
 
int calcDisplayNumber () const
 Calculates the visible number of the measure, based on the first MeasureNumberRegion that contains it.
 
std::shared_ptr< KeySignaturecreateKeySignature (const std::optional< InstCmper > &forStaff=std::nullopt) const
 Creates and returns a shared pointer to an instance of the KeySignature for this measure and staff.
 
std::shared_ptr< TimeSignaturecreateTimeSignature (const std::optional< InstCmper > &forStaff=std::nullopt) const
 Create a shared pointer to an instance of the TimeSignature for this measure and staff.
 
std::shared_ptr< TimeSignaturecreateDisplayTimeSignature (const std::optional< InstCmper > &forStaff=std::nullopt) const
 Create a shared pointer to an instance of the display TimeSignature for this measure and staff.
 
void integrityCheck () override
 Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes.
 
bool requireAllFields () const override
 
- Public Member Functions inherited from musx::dom::OthersBase
Cmper getCmper () const
 Gets the cmper key value.
 
std::optional< IncigetInci () const
 Gets the optional array index (inci).
 
- Public Member Functions inherited from musx::dom::Base
virtual ~Base () noexcept(false)=default
 Virtual destructor for polymorphic behavior.
 
DocumentPtr getDocument () const
 Gets a reference to the Document.
 
Cmper getPartId () const
 Gets the partId for this instance (or 0 for score)
 
std::shared_ptr< others::PartDefinitiongetPartDefinition () const
 Gets the others::PartDefinition corresponding to getPartId.
 
ShareMode getShareMode () const
 Gets the sharing mode for this instance.
 
const SharedNodesgetUnlinkedNodes () const
 Gets the unlinked nodes for this instance. (Only populated for ShareMode::Partial)
 
void addUnlinkedNode (const std::string &nodeName)
 Adds a shared node for this instance.
 

Static Public Member Functions

static const xml::XmlElementArray< Measure > & xmlMappingArray ()
 Required for musx::factory::FieldPopulator.
 

Public Attributes

Evpu width {}
 "Ideal" measure width in Evpu. Page layout determines actual width.
 
std::shared_ptr< KeySignatureglobalKeySig
 the key global signature on this measure. Guaranteed to be non-null. (xml node is <keySig>)
 
Cmper beats {}
 Number of beats in the measure or the Cmper to a timesigUpper composite numerator list.
 
Cmper divBeat {}
 Divisions per beat (Edu) or the Cmper to a timesigLower composite denominator list.
 
Cmper dispBeats {}
 Displayed beats in the measure or the Cmper to a timesigUpper composite numerator list.
 
Cmper dispDivbeat {}
 Displayed divisions per beat (Edu) or the Cmper to a timesigLower composite denominator list.
 
Evpu frontSpaceExtra {}
 Extra space at front of bar.
 
Evpu backSpaceExtra {}
 Extra space at end of bar.
 
bool breakWordExt {}
 Barline ends word extensions on lyrics.
 
bool hideCaution {}
 "Hide Cautionary Clefs, Key, and Time Signature"
 
bool hasSmartShape {}
 Indicates if the measure has a smart shape.
 
bool showFullNames {}
 "Show Full Staff & Group Names"
 
bool allowSplitPoints {}
 "Allow Horizontal Split Points" (xml node is <posSplit>)
 
bool groupBarlineOverride {}
 Override the barline specified by a details::StaffGroup (if any)
 
Cmper customBarShape {}
 Cmper of Shape Designer ShapeDef for custom right barline.
 
Cmper customLeftBarShape {}
 Cmper of Shape Designer ShapeDef for custom left barline.
 
ShowKeySigMode showKey {}
 Show mode for key signatures.
 
ShowTimeSigMode showTime {}
 Show mode for time signatures.
 
PositioningType positioningMode {}
 Positioning type for the measure. (xml node is <posMode>)
 
bool beginNewSystem {}
 "Begin a New Staff System" (xml node is <lineBreak>)
 
bool breakMmRest {}
 "Break a Multimeasure Rests" (xml node is <breakRest>)
 
bool noMeasNum {}
 Inverse of "Include in Measure Numbering".
 
BarlineType barlineType {}
 Barline type. (xml node is <barline>)
 
bool evenlyAcrossMeasure {}
 "Position Evenly Across Measure" (xml node is <indivPosDef>)
 
bool hasExpression {}
 Indicates if the measure has an expression assigned. See MeasureExprAssign. (xml node is <hasExpr>)
 
bool forwardRepeatBar {}
 Indicates a forward repeat bar on this measure. (xml node is <forRepBar>)
 
bool backwardsRepeatBar {}
 Indicates a forward repeat bar on this measure. (xml node is <bacRepBar>)
 
bool hasEnding {}
 Indicates the presence of a repeat ending. (xml node is <barEnding>)
 
bool hasTextRepeat {}
 Indicates the presence of one or more text repeat assigments. (xml node is <txtRepeats>)
 
bool hasChord {}
 Indicates the presence of one or more chords.
 
bool compositeNumerator {}
 Indicates a composite numerator for the time signature. (xml node is <altNumTsig>)
 
bool compositeDenominator {}
 Indicates a composite denominator for the time signature. (xml node is <altDenTsig>)
 
bool abbrvTime {}
 
bool useDisplayTimesig {}
 Indicates whether to use the display time signature.
 
BarlineType leftBarlineType {}
 Left barline type. (xml node is <leftBarline>)
 
bool compositeDispNumerator {}
 Indicates a composite numerator for the display time signature. (xml node is <displayAltNumTsig>)
 
bool compositeDispDenominator {}
 Indicates a composite denominator for the display time signature. (xml node is <displayAltDenTsig>)
 

Static Public Attributes

static constexpr std::string_view XmlNodeName = "measSpec"
 The XML node name for this type.
 

Additional Inherited Members

- Protected Member Functions inherited from musx::dom::OthersBase
 OthersBase (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, std::optional< Inci > inci=std::nullopt)
 Constructs an OthersBase object.
 
- Protected Member Functions inherited from musx::dom::Base
 Base (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode)
 Constructs the base class and enforces the static constexpr XmlNodeName.
 
Baseoperator= (const Base &)
 assignment constructor: m_unlinkedNodes is intentionally omitted
 

Detailed Description

Represents the attributes of a measure.

This class is identified by the XML node name "measSpec".

Member Enumeration Documentation

◆ BarlineType

Barline type for left and right barlines.

Enumerator
None 

No barline. (This is the default value for the enum.)

OptionsDefault 

Left barlines only: use value from options::BarlineOptions (xml values is "default")

Normal 

Normal barline.

Double 

Double barline.

Final 

Final barline.

Solid 

Solid (thick) barline.

Dashed 

Dashed barline (xml value is "dash")

Tick 

Right barlines only: tick barline (xml value is "partial")

Custom 

Custom barline (created with Shape Designer)

◆ PositioningType

Positioning (music spacing) type for the measure.

Enumerator
Manual 

"Manually (By Dragging)" the default.

TimeSignature 

Legacy option "Use the Time Signature" (xml node is <timesig>)

BeatChart 

Legacy option "Use a Beat Positioning Chart" (xml node is <beatchart>)

TimeSigPlusPositioning 

"According to the Time Signature" (xml node is <timesigPlusPos>)

BeatChartPlusPositioning 

"Using Beat-Chart Spacing" (xml node is <beatchartPlusPos>)

◆ ShowKeySigMode

How and whether to show a Key Signature in this measure.

Enumerator
IfNeeded 

Show if needed (the default)

Always 

Always show (xml value is "deltaKey")

Never 

Never show (xml value is "ignoreKey")

◆ ShowTimeSigMode

How and whether to show a Time Signature in this measure.

Enumerator
IfNeeded 

Show if needed (the default)

Always 

Always show (xml value is "deltaTime")

Never 

Never show (xml value is "ignoreTime")

Member Function Documentation

◆ calcDisplayNumber()

int musx::dom::others::Measure::calcDisplayNumber ( ) const

Calculates the visible number of the measure, based on the first MeasureNumberRegion that contains it.

Depending on the display options of the found MeasureNumberRegion, the number may or may not appear in the score. And if it does, it may not appear as a number.

◆ createDisplayTimeSignature()

std::shared_ptr< TimeSignature > musx::dom::others::Measure::createDisplayTimeSignature ( const std::optional< InstCmper > &  forStaff = std::nullopt) const

Create a shared pointer to an instance of the display TimeSignature for this measure and staff.

Parameters
forStaffIf present, specifies the specific staff for which to create the time signature.
Returns
The display time signature if there is one, otherwise the actual time signature.

◆ createKeySignature()

std::shared_ptr< KeySignature > musx::dom::others::Measure::createKeySignature ( const std::optional< InstCmper > &  forStaff = std::nullopt) const

Creates and returns a shared pointer to an instance of the KeySignature for this measure and staff.

Parameters
forStaffIf present, specifies the specific staff for which to create the key signature.
Returns
A shared pointer to a new instance of KeySignature. The caller may modify it (e.g., for tranposition) without affecting the values in the document.

◆ createTimeSignature()

std::shared_ptr< TimeSignature > musx::dom::others::Measure::createTimeSignature ( const std::optional< InstCmper > &  forStaff = std::nullopt) const

Create a shared pointer to an instance of the TimeSignature for this measure and staff.

Parameters
forStaffIf present, specifies the specific staff for which to create the time signature.

◆ integrityCheck()

void musx::dom::others::Measure::integrityCheck ( )
inlineoverridevirtual

Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes.

The default implementation should always be called inside an overridden implementation.

Exceptions
musx::dom::integrity_errorif there is a problem.

Reimplemented from musx::dom::Base.

◆ requireAllFields()

bool musx::dom::others::Measure::requireAllFields ( ) const
inlineoverridevirtual
Todo:
: remove this override after identifying all fields.

Reimplemented from musx::dom::Base.

Member Data Documentation

◆ abbrvTime

bool musx::dom::others::Measure::abbrvTime {}

Indicates abbreviated time signature (e.g., Common or Cut time.) Applies to the display time signature only. The actual time signature's abbreviation is controlled by the values in options::TimeSignatureOptions.