MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::details::GFrameHoldContext Class Reference

A context wrapper for GFrameHold associated with a specific part and location. More...

#include <Entries.h>

Public Member Functions

 GFrameHoldContext (const DocumentPtr &document, Cmper partId, Cmper inst, Cmper meas)
 Constructs a context-aware GFrameHold wrapper.
 
Cmper getRequestedPartId () const
 Returns the requested part ID associated with this context.
 
const GFrameHoldoperator-> () const
 Provides const pointer-style access to the underlying GFrameHold.
 
 operator bool () const
 Returns true if the internal GFrameHold is valid.
 
ClefIndex calcClefIndexAt (Edu position) const
 Returns the clef index in effect for at the specified Edu position. This function does not take into account transposing clefs. Those are addressed in createEntryFrame.
 
ClefIndex calcClefIndexAt (util::Fraction position) const
 Returns the clef index in effect for at the specified util::Fraction position (as a fraction of whole notes). This function does not take into account transposing clefs. Those are addressed in createEntryFrame.
 
std::shared_ptr< const EntryFramecreateEntryFrame (LayerIndex layerIndex) const
 Returns the EntryFrame for all entries in the given layer.
 
bool iterateEntries (LayerIndex layerIndex, std::function< bool(const EntryInfoPtr &)> iterator)
 iterates the entries for the specified layer in this GFrameHold from left to right
 
bool iterateEntries (std::function< bool(const EntryInfoPtr &)> iterator)
 iterates the entries for this GFrameHold from left to right for each layer in order
 
std::map< LayerIndex, bool > calcVoices () const
 Calculates the number of voices used by the GFrameHold instance.
 
bool calcIsCuesOnly () const
 Calculates if this staff in this measure contains only a cue layer and full-measure rest layers.
 

Detailed Description

A context wrapper for GFrameHold associated with a specific part and location.

This class retrieves the appropriate GFrameHold from a Document using part, instrument, and measure IDs, and enables part-aware operations like iterating over EntryFrame objects.

Constructor & Destructor Documentation

◆ GFrameHoldContext()

musx::dom::details::GFrameHoldContext::GFrameHoldContext ( const DocumentPtr document,
Cmper  partId,
Cmper  inst,
Cmper  meas 
)

Constructs a context-aware GFrameHold wrapper.

Parameters
documentWeak pointer to the owning Document.
partIdThe requested part ID.
instThe instrument ID for.
measThe measure ID for.

Member Function Documentation

◆ calcClefIndexAt() [1/2]

ClefIndex musx::dom::details::GFrameHoldContext::calcClefIndexAt ( Edu  position) const

Returns the clef index in effect for at the specified Edu position. This function does not take into account transposing clefs. Those are addressed in createEntryFrame.

Parameters
positionThe Edu position of the clef in staff-level Edus. (The staff-level matters for Independent Key Signature staves.)

◆ calcClefIndexAt() [2/2]

ClefIndex musx::dom::details::GFrameHoldContext::calcClefIndexAt ( util::Fraction  position) const
inline

Returns the clef index in effect for at the specified util::Fraction position (as a fraction of whole notes). This function does not take into account transposing clefs. Those are addressed in createEntryFrame.

Parameters
positionThe staff-level position of the clef. (The staff-level matters for Independent Key Signature staves.)

◆ calcVoices()

std::map< LayerIndex, bool > musx::dom::details::GFrameHoldContext::calcVoices ( ) const

Calculates the number of voices used by the GFrameHold instance.

Returns
A list of each layer that contains entries and whether that layer uses voice2.

◆ createEntryFrame()

std::shared_ptr< const EntryFrame > musx::dom::details::GFrameHoldContext::createEntryFrame ( LayerIndex  layerIndex) const

Returns the EntryFrame for all entries in the given layer.

Parameters
layerIndexThe layer index (0..3) to iterate.
Returns
EntryFrame for layer or nullptr if none.

◆ getRequestedPartId()

Cmper musx::dom::details::GFrameHoldContext::getRequestedPartId ( ) const
inline

Returns the requested part ID associated with this context.

Returns
The requested part ID.

◆ iterateEntries() [1/2]

bool musx::dom::details::GFrameHoldContext::iterateEntries ( LayerIndex  layerIndex,
std::function< bool(const EntryInfoPtr &)>  iterator 
)

iterates the entries for the specified layer in this GFrameHold from left to right

Parameters
layerIndexThe layer index (0..3) to iterate.
iteratorThe callback function for each iteration.
Returns
true if higher-level iteration should continue. false if it should halt.
Exceptions
std::invalid_argumentif the layer index is out of range

◆ iterateEntries() [2/2]

bool musx::dom::details::GFrameHoldContext::iterateEntries ( std::function< bool(const EntryInfoPtr &)>  iterator)

iterates the entries for this GFrameHold from left to right for each layer in order

Parameters
iteratorThe callback function for each iteration.
Returns
true if higher-level iteration should continue. false if it should halt.

◆ operator bool()

musx::dom::details::GFrameHoldContext::operator bool ( ) const
inlineexplicit

Returns true if the internal GFrameHold is valid.

Returns
True if the GFrameHold was successfully retrieved; false otherwise.

◆ operator->()

const GFrameHold * musx::dom::details::GFrameHoldContext::operator-> ( ) const
inline

Provides const pointer-style access to the underlying GFrameHold.

Returns
A const pointer to GFrameHold.