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

Represents a document object that encapsulates the entire EnigmaXML structure. More...

#include <Document.h>

Public Member Functions

HeaderPtrgetHeader ()
 Retrieves the header.
 
const HeaderPtrgetHeader () const
 Retrieves the const header.
 
OptionsPoolPtrgetOptions ()
 Retrieves the options pool.
 
const OptionsPoolPtrgetOptions () const
 Retrieves the const options pool.
 
OthersPoolPtrgetOthers ()
 Retrieves the others pool.
 
const OthersPoolPtrgetOthers () const
 Retrieves the const others pool.
 
DetailsPoolPtrgetDetails ()
 Retrieves the details pool.
 
const DetailsPoolPtrgetDetails () const
 Retrieves the const others pool.
 
EntryPoolPtrgetEntries ()
 Retrieves the entry pool.
 
const EntryPoolPtrgetEntries () const
 Retrieves the entry others pool.
 
TextsPoolPtrgetTexts ()
 Retrieves the texts pool.
 
const TextsPoolPtrgetTexts () const
 Retrieves the const texts pool.
 
constexpr Cmper calcScrollViewCmper (Cmper partId) const noexcept
 Returns the Scroll View Cmper for the given partId.
 
MusxInstanceList< others::StaffUsedgetScrollViewStaves (Cmper partId) const
 Returns the scroll view staves for the given partId.
 
MusxInstance< others::PagecalculatePageFromMeasure (Cmper partId, MeasCmper measureId) const
 Searches pages to find the page that contains the measure.
 
MusxInstance< others::StaffSystemcalculateSystemFromMeasure (Cmper partId, MeasCmper measureId) const
 Searches systems to find the page that contains the measure.
 
int getMaxBlankPages () const
 Returns the maximum number of blank pages in any part. This is calculated by factory::DocumentFactory::create.
 
const InstrumentMapgetInstruments () const
 Returns the instrument map for this document. It is computed by the factory.
 
const InstrumentInfogetInstrumentForStaff (StaffCmper staffId) const
 Get the instrument info for the given staffId.
 
InstrumentMap createInstrumentMap (Cmper forPartId) const
 Builds an instrument map for the specified linked part ID.
 
bool calcHasVaryingSystemStaves (Cmper forPartId) const
 Calculate if the current score/part has staves that differ from system to system.
 
MusicRange calcEntireDocument () const
 Calcuate a MusicRange instance for the entire document.
 
bool iterateEntries (Cmper partId, std::function< bool(const EntryInfoPtr &)> iterator) const
 Iterate all entries in the document by staff and then measure. This function wraps MusxInstanceList<others::StaffUsed>::iterateEntries.
 

Friends

class musx::factory::DocumentFactory
 

Detailed Description

Represents a document object that encapsulates the entire EnigmaXML structure.

Member Function Documentation

◆ calcHasVaryingSystemStaves()

bool musx::dom::Document::calcHasVaryingSystemStaves ( Cmper  forPartId) const

Calculate if the current score/part has staves that differ from system to system.

Parameters
forPartIdThe linked score or part ID to check.

◆ calcScrollViewCmper()

constexpr Cmper musx::dom::Document::calcScrollViewCmper ( Cmper  partId) const
inlineconstexprnoexcept

Returns the Scroll View Cmper for the given partId.

Parameters
partIdThe linked part to check.

◆ calculatePageFromMeasure()

MusxInstance< others::Page > musx::dom::Document::calculatePageFromMeasure ( Cmper  partId,
MeasCmper  measureId 
) const

Searches pages to find the page that contains the measure.

Parameters
partIdthe linked part to search
measureIdthe measure to find

◆ calculateSystemFromMeasure()

MusxInstance< others::StaffSystem > musx::dom::Document::calculateSystemFromMeasure ( Cmper  partId,
MeasCmper  measureId 
) const

Searches systems to find the page that contains the measure.

Parameters
partIdthe linked part to search
measureIdthe measure to find

◆ createInstrumentMap()

InstrumentMap musx::dom::Document::createInstrumentMap ( Cmper  forPartId) const

Builds an instrument map for the specified linked part ID.

This routine detects instrument groupings in three stages:

  1. Defined multi-staff instruments (via multiStaffInstId).
  2. Visually bracketed staves with matching instrument UUIDs.
  3. Remaining single staves as individual instruments.

This is especially important for supporting legacy .musx files created before multi-staff instruments were defined explicitly.

Parameters
forPartIdThe linked part for which to create the map.

◆ getInstrumentForStaff()

const InstrumentInfo & musx::dom::Document::getInstrumentForStaff ( StaffCmper  staffId) const

Get the instrument info for the given staffId.

Parameters
staffIdThe staffId to find.

◆ getScrollViewStaves()

MusxInstanceList< others::StaffUsed > musx::dom::Document::getScrollViewStaves ( Cmper  partId) const

Returns the scroll view staves for the given partId.

Parameters
partIdThe linked part to check.

◆ iterateEntries()

bool musx::dom::Document::iterateEntries ( Cmper  partId,
std::function< bool(const EntryInfoPtr &)>  iterator 
) const

Iterate all entries in the document by staff and then measure. This function wraps MusxInstanceList<others::StaffUsed>::iterateEntries.

Parameters
partIdThe linked part id to iterate. (Use SCORE_PARTID to iterate the score.)
iteratorThe callback function.
Returns
True if iteration completed. False if the iterator returned false and exited early.