MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::MusxInstanceList< others::StaffUsed > Class Reference

Specialization for others::StaffUsed that adds methods for processing the array as a whole. More...

#include <MusxInstance.h>

+ Inheritance diagram for musx::dom::MusxInstanceList< others::StaffUsed >:

Public Member Functions

MusxInstance< others::StaffgetStaffInstanceAtIndex (size_t index) const
 Returns the others::Staff instance (without any staff styles applied) at a specified index of iuArray or nullptr if not found.
 
MusxInstance< others::StaffCompositegetStaffInstanceAtIndex (size_t index, MeasCmper measureId, Edu eduPosition=0) const
 Returns the current others::StaffComposite instance at a specified index of iuArray or nullptr if not found.
 
std::optional< size_t > getIndexForStaff (StaffCmper staffId) const
 Returns the 0-based index of the StaffCmper or std::nullopt if not found.
 
StaffCmper getTopStaffId () const
 Returns the top staff id or zero if none.
 
StaffCmper getBottomStaffId () const
 Returns the bottom staff id or zero if none.
 
bool iterateEntries (size_t startIndex, size_t endIndex, const MusicRange &range, std::function< bool(const EntryInfoPtr &)> iterator) const
 Iterates all the entries that start within the input MusicRange. It iterates by staff and then measure. If an entry starts before the range, it is excluded even if its duration takes it within the range. Conversely, an entry is included if it starts within the range, even if its duration takes it outside the range. If startIndex is less than endIndex, the staves are iterated upwards. Otherwise they are interated downwards.
 
- Public Member Functions inherited from musx::dom::MusxInstanceListBase< others::StaffUsed >
 MusxInstanceListBase (const std::weak_ptr< Document > &document, Cmper partId)
 Default constructor.
 
Cmper getRequestedPartId () const
 Gets the part id that was used to create this list.
 
std::shared_ptr< DocumentgetDocument () const
 Gets the document that was used to create this list.
 

Detailed Description

Specialization for others::StaffUsed that adds methods for processing the array as a whole.

Member Function Documentation

◆ getIndexForStaff()

std::optional< size_t > musx::dom::MusxInstanceList< others::StaffUsed >::getIndexForStaff ( StaffCmper  staffId) const

Returns the 0-based index of the StaffCmper or std::nullopt if not found.

Parameters
staffIdThe others::Staff cmper value to find.

◆ getStaffInstanceAtIndex() [1/2]

MusxInstance< others::Staff > musx::dom::MusxInstanceList< others::StaffUsed >::getStaffInstanceAtIndex ( size_t  index) const

Returns the others::Staff instance (without any staff styles applied) at a specified index of iuArray or nullptr if not found.

Parameters
indexThe 0-based index to find.

◆ getStaffInstanceAtIndex() [2/2]

MusxInstance< others::StaffComposite > musx::dom::MusxInstanceList< others::StaffUsed >::getStaffInstanceAtIndex ( size_t  index,
MeasCmper  measureId,
Edu  eduPosition = 0 
) const

Returns the current others::StaffComposite instance at a specified index of iuArray or nullptr if not found.

Parameters
indexThe 0-based index to find.
measureIdThe measure of the location to get.
eduPositionThe edu position of the location to get.

◆ iterateEntries()

bool musx::dom::MusxInstanceList< others::StaffUsed >::iterateEntries ( size_t  startIndex,
size_t  endIndex,
const MusicRange range,
std::function< bool(const EntryInfoPtr &)>  iterator 
) const

Iterates all the entries that start within the input MusicRange. It iterates by staff and then measure. If an entry starts before the range, it is excluded even if its duration takes it within the range. Conversely, an entry is included if it starts within the range, even if its duration takes it outside the range. If startIndex is less than endIndex, the staves are iterated upwards. Otherwise they are interated downwards.

Parameters
startIndexThe first staff index to iterate.
endIndexThe last staff index to inerate.
rangeThe music range to iterate. It should be expressed in global position values.
iteratorThe iterator function. Return false from this function to stop iterating.
Returns
True if all items were iterated. False if the iterator returned false and exited early.