LCOV - code coverage report
Current view: top level - src/importexport/tabledit/internal - readinglist.h Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 8 8
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              : #pragma once
      23              : 
      24              : #include <optional>
      25              : #include <vector>
      26              : 
      27              : #include "importtef.h"
      28              : 
      29              : namespace mu::iex::tabledit {
      30              : struct Ending {
      31              :     int duration { 1 };
      32              :     int number { 1 };
      33              : };
      34              : 
      35              : struct MeasureStatus
      36              : {
      37              :     bool barlineDouble { false };
      38              :     bool barlineEnd { false };
      39              :     std::optional<Ending> ending;
      40              :     int repeatCount { 0 };
      41              :     bool repeatEnd { false };
      42              :     bool repeatStart { false };
      43              :     bool isRegular();
      44              : };
      45              : 
      46              : struct SimplifiedItem {
      47              :     int first { 0 };
      48              :     int last { 0 };
      49           22 :     constexpr bool isConsecutiveWith(const SimplifiedItem& rhs) const { return last + 1 == rhs.first; }
      50           16 :     constexpr bool operator==(const SimplifiedItem& rhs) const { return first == rhs.first && last == rhs.last; }
      51           14 :     constexpr bool overlapsWith(const SimplifiedItem& rhs) const { return !(rhs.last < first || rhs.first > last); }
      52            2 :     constexpr SimplifiedItem& operator+=(const SimplifiedItem& rhs)
      53              :     {
      54            2 :         if (isConsecutiveWith(rhs)) {
      55            2 :             last = rhs.last;
      56              :         }
      57            2 :         return *this;
      58              :     }
      59              : };
      60              : 
      61              : class ReadingList
      62              : {
      63              : public:
      64              :     void calculate(const size_t nMeasures, const std::vector<TefReadingListItem>& tefReadingList);
      65          625 :     const std::vector<MeasureStatus>& status() const { return m_status; }
      66              : private:
      67              :     void initializeList(const size_t nMeasures, const std::vector<TefReadingListItem>& tefReadingList);
      68              :     void analyze();
      69              :     std::vector<SimplifiedItem> m_list;
      70              :     std::vector<MeasureStatus> m_status;
      71              : };
      72              : } // namespace mu::iex::tabledit
        

Generated by: LCOV version 2.0-1