Planeshift
|
Implements a musical score. More...
#include <basemusicscore.h>
Classes | |
class | Cursor |
This is part of the BaseMusicalScore API. More... | |
Public Member Functions | |
bool | AdvanceCursor (bool ignoreEndOfMeasure) |
BaseMusicalScore () | |
Create an empty score in edit mode. | |
Cursor * | GetEditCursor () |
Return the cursor if the score is in edit mode. | |
const MeasureType < MeasureElementType > * | GetMeasure (size_t n) const |
Return the n-th measure in the score. | |
size_t | GetNMeasures () const |
Return the number of measures in the score. | |
const Cursor * | GetPlayCursor () const |
Return the cursor if the score is in play mode. | |
Cursor * | SetEditMode () |
Set the mode to edit. | |
const Cursor * | SetPlayMode () |
Set the mode to play. | |
~BaseMusicalScore () | |
Destructor. |
Implements a musical score.
Central object of this class is the cursor which is part of BaseMusicalScore's interface to all intent and purposes. The score can be in edit or in play mode. When in play mode, it is read-only.
Though the content of the score can be read with BaseMusicalScore::GetMeasure(), using the cursor is the only way to modify it. After you set the score mode through BaseMusicalScore::SetEditMode() and BaseMusicalScore::SetPlayMode(), a reference of the score can be retrieved by using the methods BaseMusicalScore::GetEditCursor() and BaseMusicalScore::GetPlayCursor().
The read-only property of the score in play mode is enforced by exploiting the Cursor class const-correctness. The drawback of this design is that you will not be able to move the cursor by calling its methods in play mode. To circumvent this, work-around methods are provided in BaseMusicalScore. You can use BaseMusicalScore::AdvanceCursor() instead of BaseMusicalScore::Cursor::Advance() for example.
Definition at line 59 of file basemusicscore.h.
BaseMusicalScore< MeasureType, MeasureElementType >::BaseMusicalScore | ( | ) |
Create an empty score in edit mode.
BaseMusicalScore< MeasureType, MeasureElementType >::~BaseMusicalScore | ( | ) |
Destructor.
bool BaseMusicalScore< MeasureType, MeasureElementType >::AdvanceCursor | ( | bool | ignoreEndOfMeasure | ) |
Move the cursor to the next element.
This takes into account repeat sections only if the score is in play mode. If the current element is the last one of the score, false is returned and the cursor is moved to the end-of-score element. Any subsequent call will not affect the cursor and return false.
ignoreEndOfMeasure | Skip end-of-measure elements if true. |
Cursor* BaseMusicalScore< MeasureType, MeasureElementType >::GetEditCursor | ( | ) |
Return the cursor if the score is in edit mode.
const MeasureType<MeasureElementType>* BaseMusicalScore< MeasureType, MeasureElementType >::GetMeasure | ( | size_t | n | ) | const |
Return the n-th measure in the score.
n | The index of the measure to retrieve. Must be valid. |
size_t BaseMusicalScore< MeasureType, MeasureElementType >::GetNMeasures | ( | ) | const [inline] |
Return the number of measures in the score.
Definition at line 101 of file basemusicscore.h.
const Cursor* BaseMusicalScore< MeasureType, MeasureElementType >::GetPlayCursor | ( | ) | const |
Return the cursor if the score is in play mode.
The cursor if the score is in play mode, 0 otherwise.
Cursor* BaseMusicalScore< MeasureType, MeasureElementType >::SetEditMode | ( | ) |
Set the mode to edit.
If the score is in play mode, the previous cursor is invalidated and the new one starts from the beginning of the score.
const Cursor* BaseMusicalScore< MeasureType, MeasureElementType >::SetPlayMode | ( | ) |
Set the mode to play.
If the score is in edit mode, the previous cursor is invalidated and the new one starts from the beginning of the score.