From 46068265e42e062d37262495a5b0a5ea42d95dba Mon Sep 17 00:00:00 2001 From: lasconic Date: Wed, 13 Mar 2013 18:15:36 +0100 Subject: [PATCH] replace typedef iSigEvent by auto --- libmscore/exportmidi.cpp | 6 +++--- libmscore/midifile.cpp | 2 +- libmscore/sig.cpp | 22 +++++++++++----------- libmscore/sig.h | 3 --- mscore/importmidi.cpp | 4 ++-- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/libmscore/exportmidi.cpp b/libmscore/exportmidi.cpp index 814376cfea..b906d4ca30 100644 --- a/libmscore/exportmidi.cpp +++ b/libmscore/exportmidi.cpp @@ -93,10 +93,10 @@ void ExportMidi::writeHeader() int endTick = startTick + rs->len; int tickOffset = rs->utick - rs->tick; - iSigEvent bs = sigmap->lower_bound(startTick); - iSigEvent es = sigmap->lower_bound(endTick); + auto bs = sigmap->lower_bound(startTick); + auto es = sigmap->lower_bound(endTick); - for (iSigEvent is = bs; is != es; ++is) { + for (auto is = bs; is != es; ++is) { SigEvent se = is->second; unsigned char* data = new unsigned char[4]; Fraction ts(se.timesig()); diff --git a/libmscore/midifile.cpp b/libmscore/midifile.cpp index c653b1eaf7..5b0e3bbdea 100644 --- a/libmscore/midifile.cpp +++ b/libmscore/midifile.cpp @@ -1087,7 +1087,7 @@ void MidiFile::changeDivision(int newDivision) t->changeDivision(newDivision); TimeSigMap sl; - for (iSigEvent is = _siglist.begin(); is != _siglist.end(); ++is) { + for (auto is = _siglist.begin(); is != _siglist.end(); ++is) { int tick = (is->first * newDivision + _division/2) / _division; SigEvent se = is->second; sl.add(tick, se); diff --git a/libmscore/sig.cpp b/libmscore/sig.cpp index aec9501bdc..c11d699103 100644 --- a/libmscore/sig.cpp +++ b/libmscore/sig.cpp @@ -102,7 +102,7 @@ void TimeSigMap::normalize() int bar = 0; int tm = ticks_measure(Fraction(z, n)); - for (iSigEvent i = begin(); i != end(); ++i) { + for (auto i = begin(); i != end(); ++i) { SigEvent& e = i->second; e.setBar(bar + (i->first - tick) / tm); bar = e.bar(); @@ -120,7 +120,7 @@ const SigEvent& TimeSigMap::timesig(int tick) const static const SigEvent ev(Fraction(4, 4)); if (empty()) return ev; - ciSigEvent i = upper_bound(tick); + auto i = upper_bound(tick); if (i != begin()) --i; return i->second; @@ -138,7 +138,7 @@ void TimeSigMap::tickValues(int t, int* bar, int* beat, int* tick) const *tick = 0; return; } - ciSigEvent e = upper_bound(t); + auto e = upper_bound(t); if (empty() || e == begin()) { qDebug("tickValue(0x%x) not found", t); abort(); @@ -183,9 +183,9 @@ const char* TimeSigMap::pos(int t) const int TimeSigMap::bar2tick(int bar, int beat) const { - ciSigEvent e; + auto e = begin(); - for (e = begin(); e != end(); ++e) { + for (; e != end(); ++e) { if (bar < e->second.bar()) break; } @@ -208,7 +208,7 @@ int TimeSigMap::bar2tick(int bar, int beat) const void TimeSigMap::write(Xml& xml) const { xml.stag("siglist"); - for (ciSigEvent i = begin(); i != end(); ++i) + for (auto i = begin(); i != end(); ++i) i->second.write(xml, i->first); xml.etag(); } @@ -299,7 +299,7 @@ unsigned TimeSigMap::raster(unsigned t, int raster) const { if (raster == 1) return t; - ciSigEvent e = upper_bound(t); + auto e = upper_bound(t); if (e == end()) { qDebug("TimeSigMap::raster(%x,)", t); return t; @@ -322,7 +322,7 @@ unsigned TimeSigMap::raster1(unsigned t, int raster) const { if (raster == 1) return t; - ciSigEvent e = upper_bound(t); + auto e = upper_bound(t); int delta = t - e->first; int ticksM = ticks_beat(e->second.timesig().denominator()) * e->second.timesig().numerator(); @@ -342,7 +342,7 @@ unsigned TimeSigMap::raster2(unsigned t, int raster) const { if (raster == 1) return t; - ciSigEvent e = upper_bound(t); + auto e = upper_bound(t); int delta = t - e->first; int ticksM = ticks_beat(e->second.timesig().denominator()) * e->second.timesig().numerator(); @@ -360,7 +360,7 @@ unsigned TimeSigMap::raster2(unsigned t, int raster) const int TimeSigMap::rasterStep(unsigned t, int raster) const { if (raster == 0) { - ciSigEvent e = upper_bound(t); + auto e = upper_bound(t); return ticks_beat(e->second.timesig().denominator()) * e->second.timesig().numerator(); } return raster; @@ -373,7 +373,7 @@ int TimeSigMap::rasterStep(unsigned t, int raster) const void TimeSigMap::dump() const { qDebug("TimeSigMap:"); - for (ciSigEvent i = begin(); i != end(); ++i) + for (auto i = begin(); i != end(); ++i) qDebug("%6d timesig: %s measure: %d", i->first, qPrintable(i->second.timesig().print()), i->second.bar()); } diff --git a/libmscore/sig.h b/libmscore/sig.h index 898407c4ad..df3af5eada 100644 --- a/libmscore/sig.h +++ b/libmscore/sig.h @@ -62,9 +62,6 @@ class SigEvent { // SigList //--------------------------------------------------------- -typedef std::map::iterator iSigEvent; -typedef std::map::const_iterator ciSigEvent; - class TimeSigMap : public std::map { void normalize(); diff --git a/mscore/importmidi.cpp b/mscore/importmidi.cpp index b6cfcecd04..5ef3e15b60 100644 --- a/mscore/importmidi.cpp +++ b/mscore/importmidi.cpp @@ -751,7 +751,7 @@ void convertMidi(Score* score, MidiFile* mf) mf->process1(); // merge noteOn/noteOff into NoteEvent etc. mf->changeDivision(MScore::division); -/* for (iSigEvent is = mf->siglist().begin(); is != mf->siglist().end(); ++is) { +/* for (auto is = mf->siglist().begin(); is != mf->siglist().end(); ++is) { qDebug(" sig at %d\n", is->first); } */ @@ -988,7 +988,7 @@ void convertMidi(Score* score, MidiFile* mf) } } - for (iSigEvent is = score->sigmap()->begin(); is != score->sigmap()->end(); ++is) { + for (auto is = score->sigmap()->begin(); is != score->sigmap()->end(); ++is) { SigEvent se = is->second; int tick = is->first; Measure* m = score->tick2measure(tick);