29#include <unordered_map>
33#include "Instrument.h"
34#include "ObjectPool.h"
35#include "MusxInstance.h"
53using namespace header;
191 MUSX_ASSERT_IF(!m_instruments.has_value()) {
192 throw std::logic_error(
"Attempted to retrieve instrument map before it was constructed.");
194 return m_instruments.value();
199 const std::optional<std::filesystem::path>&
getSourcePath()
const {
return m_sourcePath; }
274 int m_maxBlankPages{};
276 std::optional<InstrumentMap> m_instruments = std::nullopt;
281 std::optional<double> m_scoreDurationSeconds;
283 std::optional<std::filesystem::path> m_sourcePath;
285 mutable std::unordered_map<Cmper, KnownShapeDefType> m_shapeRecognitionCache;
Represents a document object that encapsulates the entire EnigmaXML structure.
Definition Document.h:88
std::optional< double > getScoreDurationSeconds() const
Returns the score playback duration in seconds, if provided by NotationMetadata.xml.
Definition Document.h:138
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<o...
Definition Document.cpp:429
const TextsPoolPtr & getTexts() const
Retrieves the const texts pool.
Definition Document.h:130
OthersPoolPtr & getOthers()
Retrieves the others pool.
Definition Document.h:106
MusxInstance< others::Page > calcPageFromMeasure(Cmper partId, MeasCmper measureId) const
Searches pages to find the page that contains the measure.
Definition Document.cpp:163
std::optional< KnownShapeDefType > getCachedShapeRecognition(Cmper shapeCmper) const
Retrieves a cached shape recognition result, if available.
Definition Document.cpp:149
const HeaderPtr & getHeader() const
Retrieves the const header.
Definition Document.h:95
MusxInstance< others::StaffSystem > calcSystemFromMeasure(Cmper partId, MeasCmper measureId) const
Searches systems to find the page that contains the measure.
Definition Document.cpp:181
const InstrumentInfo & getInstrumentForStaff(StaffCmper staffId) const
Get the instrument info for the given staffId.
Definition Document.cpp:311
int getMaxBlankPages() const
Returns the maximum number of blank pages in any part. This is calculated by factory::DocumentFactory...
Definition Document.h:185
PartVoicingPolicy getPartVoicingPolicy() const
Retrieves the document's part voicing policy.
Definition Document.h:134
const InstrumentMap & getInstruments() const
Returns the instrument map for this document. It is computed by the factory.
Definition Document.h:189
std::optional< std::filesystem::path > resolveExternalGraphicPath(Cmper fileDescId) const
Resolve an external graphic path using SCORE_PARTID.
Definition Document.cpp:438
MusxInstanceList< others::StaffUsed > getStudioViewStaves(Cmper partId) const
Returns the Studio View staves for the given partId. Normally this is only one staff and is invariant...
Definition Document.cpp:138
const std::optional< std::filesystem::path > & getSourcePath() const
Returns the path to the musx (or EnigmaXML) file used to create this document, if provided.
Definition Document.h:199
std::vector< MeasCmper > calcJumpFromMeasures(Cmper partId, MeasCmper currentMeasure) const
Calculates the measures from which playback jumped into currentMeasure.
Definition Document.cpp:359
constexpr Cmper calcScrollViewCmper(Cmper partId) const noexcept
Returns the Scroll View Cmper for the given partId.
Definition Document.h:147
const DetailsPoolPtr & getDetails() const
Retrieves the const others pool.
Definition Document.h:116
HeaderPtr & getHeader()
Retrieves the header.
Definition Document.h:92
MusxInstanceList< others::StaffUsed > getScrollViewStaves(Cmper partId) const
Returns the Scroll View staves for the given partId.
Definition Document.cpp:133
bool calcHasVaryingSystemStaves(Cmper forPartId) const
Calculate if the current score/part has staves that differ from system to system.
Definition Document.cpp:341
const OptionsPoolPtr & getOptions() const
Retrieves the const options pool.
Definition Document.h:102
const EmbeddedGraphicsMap & getEmbeddedGraphics() const
Returns all embedded graphics keyed by graphic cmper.
Definition Document.h:142
TextsPoolPtr & getTexts()
Retrieves the texts pool.
Definition Document.h:127
void setCachedShapeRecognition(Cmper shapeCmper, KnownShapeDefType type) const
Stores a shape recognition result in the cache.
Definition Document.cpp:158
const OthersPoolPtr & getOthers() const
Retrieves the const others pool.
Definition Document.h:109
InstrumentMap createInstrumentMap(Cmper forPartId) const
Builds an instrument map for the specified linked part ID.
Definition Document.cpp:198
MusicRange calcEntireDocument() const
Calcuate a MusicRange instance for the entire document.
Definition Document.cpp:335
const EntryPoolPtr & getEntries() const
Retrieves the entry others pool.
Definition Document.h:123
DetailsPoolPtr & getDetails()
Retrieves the details pool.
Definition Document.h:113
OptionsPoolPtr & getOptions()
Retrieves the options pool.
Definition Document.h:99
EntryPoolPtr & getEntries()
Retrieves the entry pool.
Definition Document.h:120
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:549
Derived description of a logical instrument in a document.
Definition Instrument.h:48
A list of instruments, which may be single- or multi-staff.
Definition Instrument.h:107
Utility class that represents of a range of musical time.
Definition CommonClasses.h:492
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:118
Factory class for creating Document objects from XML.
Definition DocumentFactory.h:49
KnownShapeDefType
Enumerates the shape types we can recognize semantically.
Definition ShapeDesigner.h:39
std::shared_ptr< OthersPool > OthersPoolPtr
Shared OthersPool pointer.
Definition ObjectPool.h:500
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:40
std::shared_ptr< DetailsPool > DetailsPoolPtr
Shared DetailsPool pointer.
Definition ObjectPool.h:587
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
std::shared_ptr< TextsPool > TextsPoolPtr
Shared OthersPool pointer.
Definition ObjectPool.h:661
PartVoicingPolicy
Controls whether Finale-style part voicing is applied when iterating entries via musx::dom::details::...
Definition Document.h:71
std::shared_ptr< OptionsPool > OptionsPoolPtr
Shared OptionsPool pointer.
Definition ObjectPool.h:446
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition DocumentElement.h:37
std::vector< uint8_t > EmbeddedGraphicBlob
Raw bytes for one embedded graphic payload from a musx archive.
Definition Document.h:56
std::unordered_map< Cmper, EmbeddedGraphicData > EmbeddedGraphicsMap
Embedded graphics keyed by cmper (filename stem in musx archive).
Definition Document.h:65
constexpr Cmper BASE_SYSTEM_ID
Definition Fundamentals.h:92
int16_t StaffCmper
Enigma staff (staffId) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
std::shared_ptr< EntryPool > EntryPoolPtr
Shared EntryPool pointer.
Definition ObjectPool.h:622
object model for musx file (enigmaxml)
Definition BaseClasses.h:38
Embedded graphic payload from a musx archive entry.
Definition Document.h:60
EmbeddedGraphicBlob bytes
Raw file bytes.
Definition Document.h:62
std::string extension
File extension without the leading dot (e.g. "png", "jpg", "svg").
Definition Document.h:61