MUSX Document Model
|
Base class to enforce polymorphism across all DOM classes. More...
#include <BaseClasses.h>
Public Types | |
enum class | ShareMode { All , Partial , None } |
Describes how this instance is shared between part and score. More... | |
using | SharedNodes = std::set< std::string > |
The container type for shared nodes. | |
Public Member Functions | |
virtual | ~Base () noexcept(false)=default |
Virtual destructor for polymorphic behavior. | |
DocumentPtr | getDocument () const |
Gets a reference to the Document. | |
virtual Cmper | getPartId () const |
Gets the partId for this instance (or SCORE_PARTID for score) | |
ShareMode | getShareMode () const |
Gets the sharing mode for this instance. | |
const SharedNodes & | getUnlinkedNodes () const |
Gets the unlinked nodes for this instance. (Only populated for ShareMode::Partial ) | |
void | addUnlinkedNode (const std::string &nodeName) |
Adds a shared node for this instance. | |
virtual void | integrityCheck () |
Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes. | |
virtual bool | requireAllFields () const |
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class. | |
Protected Member Functions | |
Base (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode) | |
Constructs the base class. | |
Base (const Base &)=default | |
explicit default copy constructor | |
Base (Base &&) noexcept=default | |
explicit default move constructor | |
Base & | operator= (const Base &) |
no-op copy assignment operator allows subclasses to copy their values. | |
Base & | operator= (Base &&) noexcept |
no-op move assignment operator allows subclasses to move their values. | |
Base class to enforce polymorphism across all DOM classes.
|
strong |
Describes how this instance is shared between part and score.
|
inlineprotected |
Constructs the base class.
document | A weak pointer to the parent document |
partId | The part ID for this instance, or zero if for score. |
shareMode | The ShareMode for this instance. |
|
inline |
|
inlinevirtual |
Gets the partId for this instance (or SCORE_PARTID for score)
get
or getArray
to retrieve an instance for a part, the value returned is either for that part or it is for the score. Therefore, this value is only reliable for determining the partId you are working on if the entity's share mode is ShareMode::None. Otherwise, it returns SCORE_PARTID for instances shared with the score.Runtime-only classes (e.g., StaffComposite) override this function to return the requested part id.
Reimplemented in musx::dom::CommonClassBase, and musx::dom::others::StaffComposite.
|
inlinevirtual |
Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes.
The default implementation should always be called inside an overridden implementation.
musx::dom::integrity_error | if there is a problem. |
Reimplemented in musx::dom::others::RepeatEndingStart, musx::dom::OthersArray< ElementType, REQUIRED_SIZE >, musx::dom::OthersArray< int >, musx::dom::OthersArray< int, 7 >, musx::dom::OthersArray< int16_t >, musx::dom::OthersArray< unsigned, 7 >, musx::dom::OthersArray< unsigned, 8 >, musx::dom::KeySignature, musx::dom::details::GFrameHold, musx::dom::details::IndependentStaffDetails, musx::dom::details::SecondaryBeamBreak, musx::dom::details::StaffGroup, musx::dom::Entry, musx::dom::options::LyricOptions, musx::dom::others::BeatChartElement, musx::dom::others::Frame, musx::dom::others::Measure, musx::dom::others::MeasureExprAssign, musx::dom::others::MultimeasureRest, musx::dom::others::MultiStaffInstrumentGroup, musx::dom::others::Staff, musx::dom::others::StaffStyle, musx::dom::others::StaffStyleAssign, musx::dom::others::SmartShape::TerminationSeg, musx::dom::others::SmartShape, musx::dom::others::SmartShapeCustomLine, and musx::dom::details::CenterShape.
|
inlinevirtual |
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class.
Some classes make it difficult to discover all the possible xml tags that might be used for all its options. An example is others::TextBlock. By overriding this function, a class can allow its members to be discovered as needed without causing error messages or throwing exceptions.
Reimplemented in musx::dom::details::TieAlterBase, musx::dom::Note, musx::dom::Entry, musx::dom::others::ArticulationDef, musx::dom::others::Measure, musx::dom::others::MeasureExprAssign, musx::dom::others::PartDefinition, musx::dom::others::ShapeDef, musx::dom::others::ShapeExpressionDef, musx::dom::others::Staff, musx::dom::others::StaffStyle::Masks, musx::dom::others::StaffStyle, musx::dom::others::TextBlock, musx::dom::others::SmartShape::EndPoint, musx::dom::others::SmartShape::EndPointAdjustment, musx::dom::others::SmartShape::TerminationSeg, musx::dom::others::SmartShape, and musx::dom::details::CenterShape.