Skip to content

Commit

Permalink
ENG-34: Improve _melismaEnds handling
Browse files Browse the repository at this point in the history
This updates the previous ENG-34 commit by simplifying the
removeMelismaEnds function.
  • Loading branch information
iveshenry18 authored and vpereverzev committed Jul 5, 2021
1 parent 871e8e1 commit 13770e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
14 changes: 2 additions & 12 deletions libmscore/chordrest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,19 +1243,9 @@ bool ChordRest::isMelismaEnd() const
// No-op and return false if Lyrics not present in _melismaEnds.
//---------------------------------------------------------

bool ChordRest::removeMelismaEnd(const Lyrics* l)
void ChordRest::removeMelismaEnd(Lyrics* const l)
{
bool found = false;
for (std::set<Lyrics*>::iterator it = _melismaEnds.begin(); it != _melismaEnds.end(); ) {
if (*it == l) {
it = _melismaEnds.erase(it); // Returns next iterator
found = true;
}
else {
++it;
}
}
return found;
_melismaEnds.erase(l);
}

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion libmscore/chordrest.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class ChordRest : public DurationElement {
int lastVerse(Placement) const;
const std::set<Lyrics*>& melismaEnds() const { return _melismaEnds; }
std::set<Lyrics*>& melismaEnds() { return _melismaEnds; }
bool removeMelismaEnd(const Lyrics* l);
void removeMelismaEnd(Lyrics* const l);
bool isMelismaEnd() const;

virtual void add(Element*);
Expand Down

0 comments on commit 13770e4

Please sign in to comment.