MuseScore  3.4
Music composition and notation
importxmlfirstpass.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2013 - 2015 Werner Schweer and others
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __IMPORTXMLFIRSTPASS_H__
14 #define __IMPORTXMLFIRSTPASS_H__
15 
16 #include "libmscore/fraction.h"
17 #include "musicxmlsupport.h"
18 
19 namespace Ms {
20 
21 typedef QMap<QString, VoiceDesc> VoiceList;
22 
23 class MusicXmlInstrList : public std::map<Fraction, QString> {
24 public:
26  const QString instrument(const Fraction f) const;
27  void setInstrument(const QString instr, const Fraction f);
28  };
29 
30 class MusicXmlOctaveShiftList : public std::map<Fraction, int> {
31 public:
33  int octaveShift(const Fraction f) const;
34  void addOctaveShift(const int shift, const Fraction f);
35  void calcOctaveShiftShifts();
36  };
37 
39 public:
41  void addNumber(const QString number);
42  QString toString() const;
43  int getLyricNo(const QString& number) const;
44  void determineLyricNos();
45 private:
46  std::map<QString, int> _numberToNo;
47  };
48 
49 class MusicXmlPart {
50 public:
51  MusicXmlPart(QString id = "", QString name = "");
52  void addMeasureNumberAndDuration(QString measureNumber, Fraction measureDuration);
53  QString getId() const { return id; }
54  QString toString() const;
55  VoiceList voicelist; // the voice map information TODO: make private
56  Fraction measureDuration(int i) const;
57  int nMeasures() const { return measureDurations.size(); }
58  MusicXmlInstrList _instrList; // TODO: make private
59  int octaveShift(const int staff, const Fraction f) const;
60  void addOctaveShift(const int staff, const int shift, const Fraction f);
61  void calcOctaveShifts();
62  void setName(QString nm) { name = nm; }
63  QString getName() const { return name; }
64  void setPrintName(bool b) { printName = b; }
65  bool getPrintName() const { return printName; }
66  void setAbbr(QString ab) { abbr = ab; }
67  QString getAbbr() const { return abbr; }
68  void setPrintAbbr(bool b) { printAbbr = b; }
69  bool getPrintAbbr() const { return printAbbr; }
70  LyricNumberHandler& lyricNumberHandler() { return _lyricNumberHandler; }
71  const LyricNumberHandler& lyricNumberHandler() const { return _lyricNumberHandler; }
72  void setMaxStaff(const int staff);
73  int maxStaff() const { return _maxStaff; }
74 private:
75  QString id;
76  QString name;
77  bool printName = true;
78  QString abbr;
79  bool printAbbr = true;
80  QStringList measureNumbers; // MusicXML measure number attribute
81  QList<Fraction> measureDurations; // duration in fraction for every measure
82  QVector<MusicXmlOctaveShiftList> octaveShifts; // octave shift list for every staff
84  int _maxStaff = 0; // maximum staff value found (1 based), 0 = none
85  };
86 
87 } // namespace Ms
88 #endif
QStringList measureNumbers
Definition: importxmlfirstpass.h:80
QString name
Definition: importxmlfirstpass.h:76
void setInstrument(const QString instr, const Fraction f)
Definition: importxmlfirstpass.cpp:112
QMap< QString, VoiceDesc > VoiceList
Definition: importxmlfirstpass.h:21
QString id
Definition: importxmlfirstpass.h:75
void setAbbr(QString ab)
Definition: importxmlfirstpass.h:66
const char * toString(Direction val)
Definition: mscore.cpp:176
LyricNumberHandler & lyricNumberHandler()
Definition: importxmlfirstpass.h:70
Definition: importxmlfirstpass.h:23
VoiceList voicelist
Definition: importxmlfirstpass.h:55
bool getPrintAbbr() const
Definition: importxmlfirstpass.h:69
LyricNumberHandler _lyricNumberHandler
Definition: importxmlfirstpass.h:83
int nMeasures() const
Definition: importxmlfirstpass.h:57
QList< Fraction > measureDurations
Definition: importxmlfirstpass.h:81
int maxStaff() const
Definition: importxmlfirstpass.h:73
void setName(QString nm)
Definition: importxmlfirstpass.h:62
MusicXmlInstrList()
Definition: importxmlfirstpass.h:25
Definition: importxmlfirstpass.h:49
Definition: aeolus.cpp:26
QString abbr
Definition: importxmlfirstpass.h:78
bool getPrintName() const
Definition: importxmlfirstpass.h:65
QString getId() const
Definition: importxmlfirstpass.h:53
std::map< QString, int > _numberToNo
Definition: importxmlfirstpass.h:46
MusicXmlOctaveShiftList()
Definition: importxmlfirstpass.h:32
QString getAbbr() const
Definition: importxmlfirstpass.h:67
QVector< MusicXmlOctaveShiftList > octaveShifts
Definition: importxmlfirstpass.h:82
MusicXmlInstrList _instrList
Definition: importxmlfirstpass.h:58
const QString instrument(const Fraction f) const
Definition: importxmlfirstpass.cpp:97
void setPrintName(bool b)
Definition: importxmlfirstpass.h:64
const LyricNumberHandler & lyricNumberHandler() const
Definition: importxmlfirstpass.h:71
Definition: importxmlfirstpass.h:30
void setPrintAbbr(bool b)
Definition: importxmlfirstpass.h:68
LyricNumberHandler()
Definition: importxmlfirstpass.h:40
Definition: fraction.h:46
Definition: importxmlfirstpass.h:38
QString getName() const
Definition: importxmlfirstpass.h:63