LCOV - code coverage report
Current view: top level - src/engraving/dom - stafflabel.h Coverage Total Hit
Test: filtered_coverage.info Lines: 85.5 % 62 53
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) 2021 MuseScore Limited
       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 "global/types/string.h"
      25              : 
      26              : namespace mu::engraving {
      27              : class StaffLabel
      28              : {
      29              : public:
      30        23046 :     StaffLabel() = default;
      31          946 :     StaffLabel(const muse::String& longName, const muse::String& shortName)
      32          946 :         : m_longName(longName), m_shortName(shortName) {}
      33              : 
      34         1762 :     bool operator==(const StaffLabel& i) const { return m_longName == i.m_longName && m_shortName == i.m_shortName; }
      35              : 
      36      1821761 :     const muse::String& longName() const { return m_longName; }
      37      1813502 :     const muse::String& shortName() const { return m_shortName; }
      38        13318 :     void setLongName(const muse::String& s) { m_longName = s; }
      39        12687 :     void setShortName(const muse::String& s) { m_shortName = s; }
      40              : 
      41         1969 :     bool empty() const { return m_longName.empty() && m_shortName.empty(); }
      42              : 
      43              : private:
      44              :     muse::String m_longName;
      45              :     muse::String m_shortName;
      46              : };
      47              : 
      48              : class InstrumentLabel : public StaffLabel
      49              : {
      50              : public:
      51              :     bool operator==(const InstrumentLabel& i) const;
      52              : 
      53        11155 :     int number() const { return m_number; }
      54           30 :     void setNumber(int v) { m_number = v; }
      55              : 
      56        10602 :     const muse::String& transposition() const { return m_transposition; }
      57            0 :     void setTransposition(const muse::String& s) { m_transposition = s; }
      58              : 
      59         6285 :     bool showNumberLong() const { return m_showNumberLong; }
      60           11 :     void setShowNumberLong(bool v) { m_showNumberLong = v; }
      61              : 
      62         4897 :     bool showNumberShort() const { return m_showNumberShort; }
      63           11 :     void setShowNumberShort(bool v) { m_showNumberShort = v; }
      64              : 
      65         6505 :     bool showTranspositionLong() const { return m_showTranspositionLong; }
      66            0 :     void setShowTranspositionLong(bool v) { m_showTranspositionLong = v; }
      67              : 
      68         5050 :     bool showTranspositionShort() const { return m_showTranspositionShort; }
      69            0 :     void setShowTranspositionShort(bool v) { m_showTranspositionShort = v; }
      70              : 
      71         9752 :     bool useCustomName() const { return m_useCustomName; }
      72            0 :     void setUseCustomName(bool v) { m_useCustomName = v; }
      73              : 
      74         1428 :     muse::String customNameLong() const { return m_customNameLong; }
      75            0 :     void setCustomNameLong(const muse::String& v) { m_customNameLong = v; }
      76              : 
      77         1428 :     muse::String customNameShort() const { return m_customNameShort; }
      78            0 :     void setCustomNameShort(const muse::String& v) { m_customNameShort = v; }
      79              : 
      80        20791 :     bool allowGroupName() const { return m_allowGroupName; }
      81           11 :     void setAllowGroupName(bool v) { m_allowGroupName = v; }
      82              : 
      83        20269 :     muse::String customNameLongGroup() const { return m_customNameLongGroup; }
      84        18841 :     void setCustomNameLongGroup(const muse::String& v) { m_customNameLongGroup = v; }
      85              : 
      86        20269 :     muse::String customNameShortGroup() const { return m_customNameShortGroup; }
      87        18841 :     void setCustomNameShortGroup(const muse::String& v) { m_customNameShortGroup = v; }
      88              : 
      89        39518 :     bool useCustomGroupName() const { return m_useCustomGroupName; }
      90        18841 :     void setUseCustomGroupName(bool v) { m_useCustomGroupName = v; }
      91              : 
      92         1428 :     muse::String customNameLongIndividual() const { return m_customNameLongIndividual; }
      93            0 :     void setCustomNameLongIndividual(const muse::String& v) { m_customNameLongIndividual = v; }
      94              : 
      95         1428 :     muse::String customNameShortIndividual() const { return m_customNameShortIndividual; }
      96            0 :     void setCustomNameShortIndividual(const muse::String& v) { m_customNameShortIndividual = v; }
      97              : 
      98         1718 :     bool useCustomIndividualName() const { return m_useCustomIndividualName; }
      99            0 :     void setUseCustomIndividualName(bool v) { m_useCustomIndividualName = v; }
     100              : 
     101              :     bool empty() const;
     102              : 
     103              : private:
     104              :     int m_number = 0;
     105              :     bool m_showNumberLong = true;
     106              :     bool m_showNumberShort = true;
     107              : 
     108              :     muse::String m_transposition;
     109              :     bool m_showTranspositionLong = true;
     110              :     bool m_showTranspositionShort = true;
     111              : 
     112              :     bool m_useCustomName = false;
     113              :     muse::String m_customNameLong;
     114              :     muse::String m_customNameShort;
     115              : 
     116              :     bool m_allowGroupName = true;
     117              : 
     118              :     muse::String m_customNameLongGroup;
     119              :     muse::String m_customNameShortGroup;
     120              :     bool m_useCustomGroupName = false;
     121              : 
     122              :     muse::String m_customNameLongIndividual;
     123              :     muse::String m_customNameShortIndividual;
     124              :     bool m_useCustomIndividualName = false;
     125              : };
     126              : 
     127         1762 : inline bool InstrumentLabel::operator==(const InstrumentLabel& i) const
     128              : {
     129         1762 :     return StaffLabel::operator==(i)
     130          334 :            && m_number == i.m_number
     131          334 :            && m_transposition == i.m_transposition
     132          334 :            && m_showNumberLong == i.m_showNumberLong
     133          334 :            && m_showNumberShort == i.m_showNumberShort
     134          334 :            && m_useCustomName == i.m_useCustomName
     135          334 :            && m_customNameLong == i.m_customNameLong
     136          334 :            && m_customNameShort == i.m_customNameShort
     137          334 :            && m_showTranspositionLong == i.m_showTranspositionLong
     138          334 :            && m_showTranspositionShort == i.m_showTranspositionShort
     139          334 :            && m_allowGroupName == i.m_allowGroupName
     140          334 :            && m_customNameLongGroup == i.m_customNameLongGroup
     141          334 :            && m_customNameShortGroup == i.m_customNameShortGroup
     142          334 :            && m_useCustomGroupName == i.m_useCustomGroupName
     143          334 :            && m_customNameLongIndividual == i.m_customNameLongIndividual
     144          334 :            && m_customNameShortIndividual == i.m_customNameShortIndividual
     145         2096 :            && m_useCustomIndividualName == i.m_useCustomIndividualName;
     146              : }
     147              : 
     148         1762 : inline bool InstrumentLabel::empty() const
     149              : {
     150         1762 :     static const InstrumentLabel EMPTY_LABEL = InstrumentLabel();
     151              : 
     152         1762 :     return *this == EMPTY_LABEL;
     153              : }
     154              : }
        

Generated by: LCOV version 2.0-1