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

Represents an entry containing metadata and notes. More...

#include <Entries.h>

+ Inheritance diagram for musx::dom::Entry:

Public Member Functions

 Entry (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, EntryNumber entnum, EntryNumber prev, EntryNumber next)
 Constructor function.
 
EntryNumber getEntryNumber () const
 Gets the entry number for this entry.
 
std::shared_ptr< EntrygetNext () const
 Gets the next entry in this list or nullptr if none.
 
std::shared_ptr< EntrygetPrevious () const
 Gets the previous entry in this list or nullptr if none.
 
std::pair< NoteType, int > calcNoteInfo () const
 Calculates the NoteType and number of augmentation dots. (See calcNoteInfoFromEdu.)
 
util::Fraction calcFraction () const
 Calculates the duration as a util::Fraction of a whole note.
 
bool hasStem () const
 Returns true if the entry's duration has a stem.
 
void integrityCheck () override
 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.
 
bool requireAllFields () const override
 Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class.
 
- Public Member Functions inherited from musx::dom::Base
virtual ~Base () noexcept(false)=default
 Virtual destructor for polymorphic behavior.
 
DocumentPtr getDocument () const
 Gets a reference to the Document.
 
Cmper getPartId () const
 Gets the partId for this instance (or 0 for score)
 
std::shared_ptr< others::PartDefinitiongetPartDefinition () const
 Gets the others::PartDefinition corresponding to getPartId.
 
ShareMode getShareMode () const
 Gets the sharing mode for this instance.
 
const SharedNodesgetUnlinkedNodes () 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.
 

Static Public Member Functions

static const xml::XmlElementArray< Entry > & xmlMappingArray ()
 Required for musx::factory::FieldPopulator.
 

Public Attributes

Edu duration {}
 Duration of the entry, not taking into account tuplets.
 
int numNotes {}
 Number of notes in the entry. There is an error if this is not the same as notes.size().
 
bool isValid {}
 Should always be true but otherwise appears to be used internally by Finale.
 
bool isNote {}
 If this value is false, the entry is a rest.
 
bool graceNote {}
 Indicate the entry is a grace note.
 
bool floatRest {}
 Is floating rest. If false, the first note element gives the staff position of the rest.
 
bool isHidden {}
 Indicates the entry is hidden, (xml node is <ignore>)
 
bool voice2 {}
 This is a V2 note. (xml node <v2>)
 
bool articDetail {}
 Indicates there is an articulation on the entry.
 
bool beam {}
 Signifies the start of a beam or singleton entry. (That is, any beam breaks at this entry.)
 
bool secBeam {}
 Signifies a secondary beam break occurs on the entry.
 
bool crossStaff {}
 Signifies that at least one note in the entry has been cross staffed.
 
bool freezeStem {}
 Freeze stem flag (upStem gives the direction.)
 
bool upStem {}
 Whether a stem is up or down. (Only reliable when freezeStem is true.)
 
bool stemDetail {}
 Indicates there are stem modification.
 
bool smartShapeDetail {}
 Indicates this entry has a smart shape assignment.
 
bool sorted {}
 Sorted flag.
 
bool lyricDetail {}
 Indicates there is a lyric assignment on the entry.
 
bool performanceData {}
 Indicates there is performance data on the entry.
 
bool freezeBeam {}
 Freeze beam flag (Derived from the presence of <freezeBeam> node.)
 
std::vector< std::shared_ptr< Note > > notes
 Collection of notes that comprise the entry. These are in order from lowest to highest.
 

Static Public Attributes

static constexpr std::string_view XmlNodeName = "entry"
 The XML node name for this type.
 

Additional Inherited Members

- Public Types inherited from musx::dom::Base
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.
 
- Protected Member Functions inherited from musx::dom::Base
 Base (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode)
 Constructs the base class and enforces the static constexpr XmlNodeName.
 
Baseoperator= (const Base &)
 assignment constructor: m_unlinkedNodes is intentionally omitted
 

Detailed Description

Represents an entry containing metadata and notes.

This class is identified by the XML node name "entry".

Constructor & Destructor Documentation

◆ Entry()

musx::dom::Entry::Entry ( const DocumentWeakPtr document,
Cmper  partId,
ShareMode  shareMode,
EntryNumber  entnum,
EntryNumber  prev,
EntryNumber  next 
)
inlineexplicit

Constructor function.

The partId and shareMode values should always be 0 and ShareMode::All, but they are required by the factory function.

Member Function Documentation

◆ getNext()

std::shared_ptr< Entry > musx::dom::Entry::getNext ( ) const

Gets the next entry in this list or nullptr if none.

Note that the entry list may contain entries that aren't in any frame. These should be ignored.

◆ getPrevious()

std::shared_ptr< Entry > musx::dom::Entry::getPrevious ( ) const

Gets the previous entry in this list or nullptr if none.

Note that the entry list may contain entries that aren't in any frame. These should be ignored.

◆ hasStem()

bool musx::dom::Entry::hasStem ( ) const
inline

Returns true if the entry's duration has a stem.

Returns
True if the entry's duration is less than a whole note, irrespective of whether it is a rest or a note.

◆ integrityCheck()

void musx::dom::Entry::integrityCheck ( )
inlineoverridevirtual

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.

Exceptions
musx::dom::integrity_errorif there is a problem.

Reimplemented from musx::dom::Base.

◆ requireAllFields()

bool musx::dom::Entry::requireAllFields ( ) const
inlineoverridevirtual

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.

Remarks
This value only escapes errors on fields. Enum values must still have all values provided to avoid error messages or exceptions.

Reimplemented from musx::dom::Base.

Member Data Documentation

◆ duration

Edu musx::dom::Entry::duration {}

Duration of the entry, not taking into account tuplets.

This is effectively the type of note (quarter, eight, whole etc.) plus the augmentation dots, if any. The most significant bit determines the note type and each set bit to the right is an augmentation dot.

(xml node is <dura>)