Skip to content

Commit 3463ea3

Browse files
committed
make namespace std and muse explicit
1 parent bd2d020 commit 3463ea3

File tree

7 files changed

+54
-46
lines changed

7 files changed

+54
-46
lines changed

src/importexport/tabledit/internal/importtef.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* MuseScore Studio
66
* Music Composition & Notation
77
*
8-
* Copyright (C) 2021 MuseScore Limited
8+
* Copyright (C) 2025 MuseScore Limited
99
*
1010
* This program is free software: you can redistribute it and/or modify
1111
* it under the terms of the GNU General Public License version 3 as
@@ -98,9 +98,9 @@ uint32_t TablEdit::readUInt32()
9898

9999
// read sized and null-terminated utf8 text from the current position
100100

101-
string TablEdit::readUtf8Text()
101+
std::string TablEdit::readUtf8Text()
102102
{
103-
string result;
103+
std::string result;
104104
uint16_t size = readUInt16();
105105
for (uint16_t i = 0; i < size - 1; ++i) {
106106
result += readUInt8();
@@ -113,7 +113,7 @@ string TablEdit::readUtf8Text()
113113
// read sized and null-terminated utf8 text
114114
// input is the position where the text's position in the file is stored
115115

116-
string TablEdit::readUtf8TextIndirect(uint32_t positionOfPosition)
116+
std::string TablEdit::readUtf8TextIndirect(uint32_t positionOfPosition)
117117
{
118118
_file->seek(positionOfPosition);
119119
uint32_t position = readUInt32();
@@ -184,17 +184,17 @@ static muse::draw::Color toColor(const int)
184184

185185
// create a VoiceAllocator for every instrument
186186

187-
void TablEdit::initializeVoiceAllocators(vector<VoiceAllocator>& allocators)
187+
void TablEdit::initializeVoiceAllocators(std::vector<VoiceAllocator>& allocators)
188188
{
189189
for (size_t i = 0; i < tefInstruments.size(); ++i) {
190190
VoiceAllocator allocator;
191191
allocators.push_back(allocator);
192192
}
193193
}
194194

195-
void TablEdit::allocateVoices(vector<VoiceAllocator>& allocators)
195+
void TablEdit::allocateVoices(std::vector<VoiceAllocator>& allocators)
196196
{
197-
vector<const TefNote*> column;
197+
std::vector<const TefNote*> column;
198198
int currentPosition { -1 };
199199
engraving::part_idx_t currentPart { 0 };
200200
for (const TefNote& tefNote : tefContents) {
@@ -308,7 +308,7 @@ void TablEdit::createContents()
308308
return;
309309
}
310310

311-
vector<VoiceAllocator> voiceAllocators;
311+
std::vector<VoiceAllocator> voiceAllocators;
312312
initializeVoiceAllocators(voiceAllocators);
313313
allocateVoices(voiceAllocators);
314314

@@ -321,7 +321,7 @@ void TablEdit::createContents()
321321
for (size_t k = 0; k < voiceContent.size(); ++k) {
322322
LOGD(" - chord %zu", k);
323323
// tefNotes is either a rest or a chord of one or more notes
324-
const vector<const TefNote*>& tefNotes { voiceContent.at(k) };
324+
const std::vector<const TefNote*>& tefNotes { voiceContent.at(k) };
325325

326326
if (tefNotes.size() == 0) {
327327
continue; // shouldn't happen
@@ -505,7 +505,7 @@ void TablEdit::createNotesFrame()
505505
vbox->setTick(mu::engraving::Fraction(0, 1)); // TODO find correct value (0/1 seems to work OK)
506506
score->measures()->add(vbox);
507507
Text* s = Factory::createText(vbox, TextStyleType::FRAME);
508-
s->setPlainText(String::fromUtf8(tefHeader.notes.c_str()));
508+
s->setPlainText(muse::String::fromUtf8(tefHeader.notes.c_str()));
509509
vbox->add(s);
510510
}
511511
}
@@ -515,7 +515,7 @@ void TablEdit::createParts()
515515
for (const auto& instrument : tefInstruments) {
516516
Part* part = new Part(score);
517517
score->appendPart(part);
518-
String staffName { String::fromUtf8(instrument.name.c_str()) };
518+
muse::String staffName { muse::String::fromUtf8(instrument.name.c_str()) };
519519
part->setPartName(staffName);
520520
part->setPlainLongName(staffName);
521521

@@ -543,19 +543,19 @@ void TablEdit::createParts()
543543
void TablEdit::createProperties()
544544
{
545545
if (!tefHeader.title.empty()) {
546-
score->setMetaTag(u"workTitle", String::fromUtf8(tefHeader.title.c_str()));
546+
score->setMetaTag(u"workTitle", muse::String::fromUtf8(tefHeader.title.c_str()));
547547
}
548548
if (!tefHeader.subTitle.empty()) {
549-
score->setMetaTag(u"subtitle", String::fromUtf8(tefHeader.subTitle.c_str()));
549+
score->setMetaTag(u"subtitle", muse::String::fromUtf8(tefHeader.subTitle.c_str()));
550550
}
551551
if (!tefHeader.comment.empty()) {
552-
score->setMetaTag(u"comment", String::fromUtf8(tefHeader.comment.c_str()));
552+
score->setMetaTag(u"comment", muse::String::fromUtf8(tefHeader.comment.c_str()));
553553
}
554554
if (!tefHeader.internetLink.empty()) {
555-
score->setMetaTag(u"source", String::fromUtf8(tefHeader.internetLink.c_str()));
555+
score->setMetaTag(u"source", muse::String::fromUtf8(tefHeader.internetLink.c_str()));
556556
}
557557
if (!tefHeader.copyright.empty()) {
558-
score->setMetaTag(u"copyright", String::fromUtf8(tefHeader.copyright.c_str()));
558+
score->setMetaTag(u"copyright", muse::String::fromUtf8(tefHeader.copyright.c_str()));
559559
}
560560
}
561561

@@ -655,12 +655,12 @@ void TablEdit::createTitleFrame()
655655
score->measures()->add(vbox);
656656
if (!tefHeader.title.empty()) {
657657
Text* s = Factory::createText(vbox, TextStyleType::TITLE);
658-
s->setPlainText(String::fromUtf8(tefHeader.title.c_str()));
658+
s->setPlainText(muse::String::fromUtf8(tefHeader.title.c_str()));
659659
vbox->add(s);
660660
}
661661
if (!tefHeader.subTitle.empty()) {
662662
Text* s = Factory::createText(vbox, TextStyleType::SUBTITLE);
663-
s->setPlainText(String::fromUtf8(tefHeader.subTitle.c_str()));
663+
s->setPlainText(muse::String::fromUtf8(tefHeader.subTitle.c_str()));
664664
vbox->add(s);
665665
}
666666
}
@@ -936,7 +936,7 @@ void TablEdit::readTefTexts()
936936
_file->seek(position);
937937
uint16_t numberOfTexts = readUInt16();
938938
for (uint16_t i = 0; i < numberOfTexts; ++i) {
939-
string text { readUtf8Text() };
939+
std::string text { readUtf8Text() };
940940
LOGD("i %d text '%s'", i, text.c_str());
941941
tefTexts.push_back(text);
942942
}

src/importexport/tabledit/internal/importtef.h

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@
2121
*/
2222
#pragma once
2323

24-
#include "voiceallocator.h"
24+
#include <array>
25+
#include <string>
26+
#include <vector>
27+
2528
#include "engraving/dom/masterscore.h"
2629
#include "engraving/engravingerrors.h"
2730
#include "io/iodevice.h"
2831

32+
#include "voiceallocator.h"
33+
2934
namespace mu::iex::tabledit {
3035
// offsets into the file header
3136
static const uint8_t OFFSET_TBED = 0x38;
@@ -74,8 +79,8 @@ class TablEdit
7479
uint8_t readUInt8();
7580
uint16_t readUInt16();
7681
uint32_t readUInt32();
77-
string readUtf8Text();
78-
string readUtf8TextIndirect(uint32_t positionOfPosition);
82+
std::string readUtf8Text();
83+
std::string readUtf8TextIndirect(uint32_t positionOfPosition);
7984

8085
struct TefHeader {
8186
int version { 0 };
@@ -111,7 +116,7 @@ class TablEdit
111116
int fClef { 0 };
112117
int output { 0 };
113118
int options { 0 };
114-
array<int, 12> tuning = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
119+
std::array<int, 12> tuning = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
115120
std::string name;
116121
};
117122

@@ -134,7 +139,7 @@ class TablEdit
134139
int index { 0 };
135140
};
136141

137-
void allocateVoices(vector<VoiceAllocator>& allocator);
142+
void allocateVoices(std::vector<VoiceAllocator>& allocator);
138143
void createContents();
139144
void createLinkedTabs();
140145
void createMeasures();
@@ -146,7 +151,7 @@ class TablEdit
146151
void createTempo();
147152
void createTexts();
148153
void createTitleFrame();
149-
void initializeVoiceAllocators(vector<VoiceAllocator>& allocators);
154+
void initializeVoiceAllocators(std::vector<VoiceAllocator>& allocators);
150155
engraving::part_idx_t partIdx(size_t stringIdx, bool& ok) const;
151156
int stringNumberPreviousParts(engraving::part_idx_t partIdx) const;
152157
void readTefContents();
@@ -157,12 +162,12 @@ class TablEdit
157162
void readTefTexts();
158163

159164
TefHeader tefHeader;
160-
vector<TefTextMarker> tefTextMarkers;
161-
vector<TefNote> tefContents; // notes (and rests) only
162-
vector<TefInstrument> tefInstruments;
163-
vector<TefMeasure> tefMeasures;
164-
vector<TefReadingListItem> tefReadingList;
165-
vector<string> tefTexts;
165+
std::vector<TefTextMarker> tefTextMarkers;
166+
std::vector<TefNote> tefContents; // notes (and rests) only
167+
std::vector<TefInstrument> tefInstruments;
168+
std::vector<TefMeasure> tefMeasures;
169+
std::vector<TefReadingListItem> tefReadingList;
170+
std::vector<std::string> tefTexts;
166171

167172
public:
168173
TablEdit(muse::io::IODevice* f, mu::engraving::MasterScore* s)

src/importexport/tabledit/internal/tableditreader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* MuseScore Studio
66
* Music Composition & Notation
77
*
8-
* Copyright (C) 2021 MuseScore Limited
8+
* Copyright (C) 2025 MuseScore Limited
99
*
1010
* This program is free software: you can redistribute it and/or modify
1111
* it under the terms of the GNU General Public License version 3 as

src/importexport/tabledit/internal/tuplethandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* MuseScore Studio
66
* Music Composition & Notation
77
*
8-
* Copyright (C) 2021 MuseScore Limited
8+
* Copyright (C) 2025 MuseScore Limited
99
*
1010
* This program is free software: you can redistribute it and/or modify
1111
* it under the terms of the GNU General Public License version 3 as

src/importexport/tabledit/internal/voiceallocator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* MuseScore Studio
66
* Music Composition & Notation
77
*
8-
* Copyright (C) 2021 MuseScore Limited
8+
* Copyright (C) 2025 MuseScore Limited
99
*
1010
* This program is free software: you can redistribute it and/or modify
1111
* it under the terms of the GNU General Public License version 3 as
@@ -45,7 +45,7 @@ bool VoiceAllocator::canAddTefNoteToVoice(const TefNote* const note, const int v
4545
return false;
4646
}
4747

48-
int VoiceAllocator::findFirstPossibleVoice(const TefNote* const note, const array<int, 3> voices)
48+
int VoiceAllocator::findFirstPossibleVoice(const TefNote* const note, const std::array<int, 3> voices)
4949
{
5050
for (const auto v : voices) {
5151
if (canAddTefNoteToVoice(note, v)) {
@@ -111,7 +111,7 @@ void VoiceAllocator::appendNoteToVoice(const TefNote* const note, int voice)
111111
LOGD("voice %d nChords %zu", voice, nChords);
112112
if (nChords == 0) {
113113
LOGD("create first chord");
114-
vector<const TefNote*> chord;
114+
std::vector<const TefNote*> chord;
115115
chord.push_back(note);
116116
voiceContents[voice].push_back(chord);
117117
} else {
@@ -122,7 +122,7 @@ void VoiceAllocator::appendNoteToVoice(const TefNote* const note, int voice)
122122
voiceContents[voice].at(nChords - 1).push_back(note);
123123
} else {
124124
LOGD("create next chord at position %d", note->position);
125-
vector<const TefNote*> chord;
125+
std::vector<const TefNote*> chord;
126126
chord.push_back(note);
127127
voiceContents[voice].push_back(chord);
128128
}
@@ -162,7 +162,7 @@ void VoiceAllocator::allocateVoice(const TefNote* const note, int voice)
162162
}
163163
}
164164

165-
void VoiceAllocator::addColumn(const vector<const TefNote*>& column)
165+
void VoiceAllocator::addColumn(const std::vector<const TefNote*>& column)
166166
{
167167
if (column.empty()) {
168168
return;

src/importexport/tabledit/internal/voiceallocator.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,32 @@
2121
*/
2222
#pragma once
2323

24+
#include <array>
25+
#include <map>
26+
#include <vector>
27+
2428
#include "engraving/dom/mscore.h"
2529

26-
using namespace std;
2730
namespace mu::iex::tabledit {
2831
struct TefNote;
2932

3033
class VoiceAllocator
3134
{
3235
public:
33-
void addColumn(const vector<const TefNote*>& column);
36+
void addColumn(const std::vector<const TefNote*>& column);
3437
void addNote(const TefNote* const note, const bool preferVoice0);
3538
void allocateVoice(const TefNote* const note, int voice);
3639
bool canAddTefNoteToVoice(const TefNote* const note, const int voice);
3740
void dump();
38-
int findFirstPossibleVoice(const TefNote* const note, const array<int, 3> voices);
41+
int findFirstPossibleVoice(const TefNote* const note, const std::array<int, 3> voices);
3942
int stopPosition(const size_t voice);
4043
int voice(const TefNote* const note);
41-
const vector<vector<const TefNote*> >& voiceContent(int voice) const { return voiceContents.at(voice); }
44+
const std::vector<std::vector<const TefNote*> >& voiceContent(int voice) const { return voiceContents.at(voice); }
4245

4346
private:
4447
void appendNoteToVoice(const TefNote* const note, int voice);
45-
map<const TefNote*, int> allocations;
46-
array<const TefNote*, mu::engraving::VOICES> notesPlaying = { nullptr, nullptr, nullptr, nullptr };
47-
array<vector<vector<const TefNote*> >, mu::engraving::VOICES> voiceContents;
48+
std::map<const TefNote*, int> allocations;
49+
std::array<const TefNote*, mu::engraving::VOICES> notesPlaying = { nullptr, nullptr, nullptr, nullptr };
50+
std::array<std::vector<std::vector<const TefNote*> >, mu::engraving::VOICES> voiceContents;
4851
};
4952
} // namespace mu::iex::tabledit

src/importexport/tabledit/tableditmodule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* MuseScore Studio
66
* Music Composition & Notation
77
*
8-
* Copyright (C) 2021 MuseScore Limited
8+
* Copyright (C) 2025 MuseScore Limited
99
*
1010
* This program is free software: you can redistribute it and/or modify
1111
* it under the terms of the GNU General Public License version 3 as

0 commit comments

Comments
 (0)