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

Utility class that represents a single location in musical time. More...

#include <CommonClasses.h>

Public Member Functions

constexpr MusicPoint ()=default
 Constructs a MusicPoint at measure 1, position 0.
 
constexpr MusicPoint (MeasCmper measId, util::Fraction pos)
 Constructs a MusicPoint object.
 
constexpr bool operator== (const MusicPoint &other) const
 Equality comparison operator.
 
constexpr bool operator!= (const MusicPoint &other) const
 Inequality comparison operator.
 
constexpr bool operator< (const MusicPoint &other) const
 Less-than comparison operator.
 
constexpr bool operator<= (const MusicPoint &other) const
 Less-than-or-equal-to comparison operator.
 
constexpr bool operator> (const MusicPoint &other) const
 Greater-than comparison operator.
 
constexpr bool operator>= (const MusicPoint &other) const
 Greater-than-or-equal-to comparison operator.
 

Public Attributes

MeasCmper measureId {1}
 Measure ID of the point.
 
util::Fraction position {}
 Position within the measure, where 1/4 is a quarter note value.
 

Detailed Description

Utility class that represents a single location in musical time.

This class is used to specify a point in musical time using a measure and a util::Fraction position within that measure. The position is expressed as a fraction of a whole note, so 1/4 is a quarter-note position.

The class is agnostic as to whether the position is a global- or staff-position value. The consuming code makes this determination.

Constructor & Destructor Documentation

◆ MusicPoint()

constexpr musx::dom::MusicPoint::MusicPoint ( MeasCmper  measId,
util::Fraction  pos 
)
inlineconstexpr

Constructs a MusicPoint object.

Parameters
measIdThe measure ID.
posThe position within the measure.

Member Function Documentation

◆ operator!=()

constexpr bool musx::dom::MusicPoint::operator!= ( const MusicPoint other) const
inlineconstexpr

Inequality comparison operator.

Parameters
otherThe other point to compare.
Returns
True if either the measure or position differs.

◆ operator<()

constexpr bool musx::dom::MusicPoint::operator< ( const MusicPoint other) const
inlineconstexpr

Less-than comparison operator.

Parameters
otherThe other point to compare.
Returns
True if this point occurs before other.

◆ operator<=()

constexpr bool musx::dom::MusicPoint::operator<= ( const MusicPoint other) const
inlineconstexpr

Less-than-or-equal-to comparison operator.

Parameters
otherThe other point to compare.
Returns
True if this point occurs at or before other.

◆ operator==()

constexpr bool musx::dom::MusicPoint::operator== ( const MusicPoint other) const
inlineconstexpr

Equality comparison operator.

Parameters
otherThe other point to compare.
Returns
True if both the measure and position match.

◆ operator>()

constexpr bool musx::dom::MusicPoint::operator> ( const MusicPoint other) const
inlineconstexpr

Greater-than comparison operator.

Parameters
otherThe other point to compare.
Returns
True if this point occurs after other.

◆ operator>=()

constexpr bool musx::dom::MusicPoint::operator>= ( const MusicPoint other) const
inlineconstexpr

Greater-than-or-equal-to comparison operator.

Parameters
otherThe other point to compare.
Returns
True if this point occurs at or after other.