LCOV - code coverage report
Current view: top level - src/engraving/dom - tiejumppointlist.h Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 15 15
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2025 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #pragma once
      24              : 
      25              : #include "global/types/string.h"
      26              : #include "global/types/translatablestring.h"
      27              : 
      28              : namespace mu::engraving {
      29              : class Note;
      30              : class Tie;
      31              : class TieJumpPointList;
      32              : 
      33              : // Items of TieJumpPointList
      34              : // Stores information about an endpoint
      35              : class TieJumpPoint
      36              : {
      37              : public:
      38              :     TieJumpPoint(Note* note, bool active, int idx, bool followingNote);
      39              :     TieJumpPoint() {}
      40              : 
      41           51 :     Note* note() const { return m_note; }
      42              :     Tie* endTie() const;
      43          110 :     bool followingNote() const { return m_followingNote; }
      44          133 :     const muse::String& id() const { return m_id; }
      45          216 :     bool active() const { return m_active; }
      46           46 :     void setActive(bool v) { m_active = v; }
      47              :     void undoSetActive(bool v);
      48              : 
      49              :     // Stores the list that this end point belongs to. This is needed to find the start tie from an endpoint
      50          189 :     void setJumpPointList(TieJumpPointList* jumpPointList) { m_jumpPointList = jumpPointList; }
      51        15588 :     TieJumpPointList* jumpPointList() { return m_jumpPointList; }
      52              : 
      53              :     muse::TranslatableString menuTitle() const;
      54              : 
      55              : private:
      56              :     muse::String precedingJumpItemName() const;
      57              :     Note* m_note = nullptr;
      58              :     bool m_active = false;
      59              :     muse::String m_id;
      60              :     TieJumpPointList* m_jumpPointList = nullptr;
      61              :     bool m_followingNote = false;
      62              : };
      63              : 
      64              : // Created & deleted by Note
      65              : // Manages adding and removing ties from endpoints
      66              : class TieJumpPointList
      67              : {
      68              : public:
      69        41778 :     TieJumpPointList(Note* note)
      70        41778 :         : m_note(note) {}
      71              :     ~TieJumpPointList();
      72              : 
      73              :     void add(TieJumpPoint* item);
      74              :     void clear();
      75          116 :     size_t size() const { return m_jumpPoints.size(); }
      76          797 :     bool empty() const { return m_jumpPoints.empty(); }
      77              : 
      78              :     Tie* startTie() const;
      79              : 
      80              :     TieJumpPoint* findJumpPoint(const muse::String& id);
      81              :     void toggleJumpPoint(const muse::String& id);
      82              : 
      83              :     void undoAddTieToScore(TieJumpPoint* jumpPoint);
      84              :     void undoRemoveTieFromScore(TieJumpPoint* jumpPoint);
      85              : 
      86         1213 :     std::vector<TieJumpPoint*>::iterator begin() { return m_jumpPoints.begin(); }
      87          141 :     std::vector<TieJumpPoint*>::const_iterator begin() const { return m_jumpPoints.begin(); }
      88         1247 :     std::vector<TieJumpPoint*>::iterator end() { return m_jumpPoints.end(); }
      89          141 :     std::vector<TieJumpPoint*>::const_iterator end() const { return m_jumpPoints.end(); }
      90              : 
      91              : private:
      92              :     std::vector<TieJumpPoint*> m_jumpPoints;
      93              :     Note* m_note = nullptr;
      94              : };
      95              : }
        

Generated by: LCOV version 2.0-1