29#include "musx/dom/BaseClasses.h"
30#include "musx/dom/CommonClasses.h"
31#include "musx/dom/Options.h"
32#include "musx/dom/Others.h"
33#include "musx/dom/Details.h"
34#include "musx/dom/SmartShape.h"
35#include "musx/dom/Entries.h"
36#include "musx/dom/Texts.h"
37#include "musx/xml/XmlInterface.h"
38#include "FieldPopulatorsOptions.h"
39#include "FieldPopulatorsOthers.h"
40#include "FieldPopulatorsDetails.h"
41#include "FieldPopulatorsTexts.h"
54template <
typename... Types>
58 using VariantType = std::variant<Types*...>;
67 static inline const auto registry = []() {
68 return std::unordered_map<std::string_view, VariantType>{
69 {Types::XmlNodeName, VariantType(
static_cast<Types*
>(
nullptr))}...
81 static std::optional<VariantType> findRegisteredType(std::string_view nodeName)
83 const auto it = registry.find(nodeName);
84 if (it == registry.end()) {
105 template <
typename PoolPtr,
typename... Args>
108 auto typePtr = TypeRegistry::findRegisteredType(node->getTagName());
109 if (!typePtr.has_value()) {
114 [&](
auto const& ptr) -> std::shared_ptr<Base> {
115 using T = std::remove_pointer_t<std::remove_reference_t<
decltype(ptr)>>;
118 auto partAttr = node->findAttribute(
"part");
121 if (
auto shareAttr = node->findAttribute(
"shared")) {
124 auto instance = std::make_shared<T>(document, partId, shareMode, std::forward<Args>(args)...);
125 if constexpr (!std::is_same_v<PoolPtr, EntryPoolPtr>) {
127 for (
auto child = node->getFirstChildElement(); child; child = child->getNextSibling()) {
128 instance->addUnlinkedNode(child->getTagName());
130 auto scoreValue = [&]() {
131 if constexpr (std::is_same_v<PoolPtr, OthersPoolPtr> || std::is_same_v<PoolPtr, DetailsPoolPtr>) {
132 return pool->template get<T>(
SCORE_PARTID, std::forward<Args>(args)...);
134 return pool->template get<T>(std::forward<Args>(args)...);
138 *instance = *scoreValue;
141 throw std::invalid_argument(
"Score instance not found for partially linked part instance");
145 factory::FieldPopulator<T>::populate(instance, node, elementLinker);
148 throw std::runtime_error(
"Type for " + node->getTagName() +
" is not constructible with given arguments");
Base class to enforce polymorphism across all DOM classes.
Definition BaseClasses.h:64
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:72
Represents an entry containing metadata and notes.
Definition Entries.h:141
Assigns an articulation to an entry.
Definition Details.h:66
Contains the baseline offsets for lyrics chorus records.
Definition Details.h:125
Contains the baseline offsets for lyrics chorus records.
Definition Details.h:139
Contains the baseline offsets for lyrics verse records.
Definition Details.h:152
Specifies the direction for beam stubs (if they are manually overridden.)
Definition Details.h:167
Represents a center shape for a others::SmartShape that spans three or more measures.
Definition SmartShape.h:263
Represents chord symbol assignment for a staff and measure.
Definition Details.h:194
Represents a cross-staff assignment for the note, if any.
Definition Details.h:258
Represents the attributes of a Finale frame holder.
Definition Details.h:283
Represents independent time and key signature overrides for a staff.
Definition Details.h:366
Contains the syllable assignments for lyrics chorus blocks.
Definition Details.h:452
Contains the syllable assignments for lyrics section blocks.
Definition Details.h:465
Contains the syllable assignments for lyrics verse blocks.
Definition Details.h:478
Specifies which secondary beams break and restart on the associated entry.
Definition Details.h:493
Assigns a smart shape to an entry.
Definition SmartShape.h:303
Represents the attributes of a Finale staff group that brackets staves.
Definition Details.h:547
Alterations for tie ends.
Definition Details.h:742
Alterations for tie starts. (Tie starts are normal ties.)
Definition Details.h:757
Options controlling the appearance of tuplets.
Definition Details.h:772
Options controlling the appearance and positioning of accidentals.
Definition Options.h:49
Options controlling the appearance of alternate notation.
Definition Options.h:72
Options controlling the appearance of augmentation dots.
Definition Options.h:96
Options controlling the appearance of barlines.
Definition Options.h:129
Options controlling the appearance of beams.
Definition Options.h:160
Options controlling chord symbol and fretboard rendering.
Definition Options.h:200
Options for configuring clefs in a musical context.
Definition Options.h:251
Options controlling the appearance and adjustments of flags.
Definition Options.h:315
An unordered map of default font settings for the document.
Definition Options.h:353
Options controlling the appearance and behavior of grace notes.
Definition Options.h:458
Options controlling the appearance and behavior of key signatures.
Definition Options.h:481
Options controlling the appearance of line and curve elements.
Definition Options.h:510
Options controlling miscellaneous settings.
Definition Options.h:540
Options controlling the appearance and behavior of multimeasure rests.
Definition Options.h:564
Options controlling music spacing.
Definition Options.h:592
Options specifying the charactes for musical symbols.
Definition Options.h:666
Options for page formatting in the document.
Definition Options.h:751
Options controlling the appearance of piano braces and brackets.
Definition Options.h:850
Options controlling the appearance of repeats.
Definition Options.h:879
Options controlling the appearance of smart shapes in the musx file.
Definition Options.h:938
Options controlling the appearance and layout of staves.
Definition Options.h:1133
Options controlling the appearance of stems.
Definition Options.h:1160
Options controlling the appearance of ties.
Definition Options.h:1185
Options controlling the appearance and behavior of time signatures.
Definition Options.h:1318
Options controlling the appearance of tuplets.
Definition Options.h:1349
Lists the aleration values of each nth flat in a custom key signature. Normally these values are all ...
Definition Others.h:75
Lists the aleration values of each nth sharp in a custom key signature. Normally these values are all...
Definition Others.h:107
Lists the order of flats by pitch class index (0..6 = C..B) in a custom key signature....
Definition Others.h:133
Lists the order of sharps by pitch class index (0..6 = C..B) in a custom key signature....
Definition Others.h:164
Stores the properties and behaviors of articulation definitions.
Definition Others.h:184
A single beat chart element from Finale's music spacing system.
Definition Others.h:315
Represents a single element in a chord suffix (e.g., a symbol like "1" or "+").
Definition Others.h:377
Represents a list of repeat ending numbers for a RepeatEndingStart instance.
Definition Others.h:424
Represents an element in multimeasure clef list with its positioning and percentage values.
Definition Others.h:443
The name and font characteristics of fonts contained.
Definition Others.h:472
Represents the attributes of a TGF entry frame.
Definition Others.h:540
An array of InstrumentUsed defines a set of staves in a staff system or in Scroll View.
Definition Others.h:582
An array of step elements from which one can create a key map.
Definition Others.h:634
Represents the attributes of a Finale "layer".
Definition Others.h:674
Represents the name associated with a MarkingCategory.
Definition Others.h:872
Represents a category of markings used.
Definition Others.h:797
Assigns a TextExpressionDef or ShapeExpressionDef to a measure.
Definition Others.h:1026
Represents the Measure Number Region with detailed font and enclosure settings for score and part dat...
Definition Others.h:1077
Represents the attributes of a measure.
Definition Others.h:890
Represents a group ID for a multi-staff setup.
Definition Others.h:1246
Represents a group of instruments spanning multiple staves.
Definition Others.h:1264
Represents the attributes of a multimeasure rest in the page layout.
Definition Others.h:1200
Represents the attributes of a page in the page layout.
Definition Others.h:1311
Represents the attributes of a Finale "partDef".
Definition Others.h:1346
Represents global values that can vary by part.
Definition Others.h:1397
Represents a repeat-backward marker with positioning and behavior properties.
Definition Others.h:1453
Represents a repeat ending start marker in the document.
Definition Others.h:1488
Represents the text associated with a RepeatEndingStart.
Definition Others.h:1545
Represents a list of repeat ending numbers for a RepeatEndingStart instance.
Definition Others.h:1566
Represents the data for instruction associated with a ShapeDef.
Definition Others.h:1583
Represents a shape created in Finale's Shape Designer.
Definition Others.h:1601
Stores the properties and behaviors of shape expressions.
Definition Others.h:1680
Represents the data for instruction associated with a ShapeDef.
Definition Others.h:1724
Assigns a smart shape or center shape to a measure.
Definition SmartShape.h:227
Represents a Finale smart shape.
Definition SmartShape.h:44
Represents an assignment.
Definition Others.h:2044
Represents a Finale staff style.
Definition Others.h:1965
Represents the attributes of a staff system in the page layout.
Definition Others.h:2112
Represents the definition of a Finale staff.
Definition Others.h:1757
A single tempo change value entered with Finale's Tempo tool.
Definition Others.h:2161
Represents the attributes of a Finale "textBlock".
Definition Others.h:2199
Stores the properties and behaviors of text expressions.
Definition Others.h:2247
The enclosure for a text expression (if it exists)
Definition Others.h:2298
Represents a text repeat assignment with positioning and behavior properties.
Definition Others.h:2315
Defines text repeat elements with font styling and justification.
Definition Others.h:2355
The enclosure for a text expression (if it exists)
Definition Others.h:2394
Represents the text associated with a TextRepeatDef.
Definition Others.h:2411
Represents the lower composite time signature array.
Definition Others.h:2434
Represents the upper composite time signature structure.
Definition Others.h:2469
Maps the number of flats to a tonal center for a linear custom key. If there are zero flats or sharps...
Definition Others.h:2513
Maps number of sharps (0..7) to a tonal center for a linear custom key. Also maps 0 sharps or flats....
Definition Others.h:2535
Contains block text (Finale Text Tool, both page- and measure-attached)
Definition Texts.h:178
Contains bookmark description text.
Definition Texts.h:223
Contains text blocks associated with text expressions.
Definition Texts.h:208
Contains File Info text (from Finale's Score Manager)
Definition Texts.h:48
Contains chorus text for lyrics.
Definition Texts.h:148
Contains section text for lyrics.
Definition Texts.h:163
Contains verse text for lyrics.
Definition Texts.h:133
Contains text blocks associated with custom line smart shapes.
Definition Texts.h:193
A utility class for managing deferred relationships between elements during document construction.
Definition FactoryBase.h:70
A registry of types for mapping XML node names to types.
Definition TypeRegistry.h:56
static std::shared_ptr< Base > createInstance(const PoolPtr &pool, const XmlElementPtr &node, ElementLinker &elementLinker, const DocumentPtr &document, Args &&... args)
Creates an instance of the registered type corresponding to the provided node name.
Definition TypeRegistry.h:106
constexpr Cmper SCORE_PARTID
The part id of the score.
Definition Fundamentals.h:75
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
std::shared_ptr< Document > DocumentPtr
Shared Document pointer.
Definition BaseClasses.h:55
std::shared_ptr< IXmlElement > XmlElementPtr
shared pointer to IXmlElement
Definition XmlInterface.h:121
object model for musx file (enigmaxml)
Definition BaseClasses.h:32