replace typedef iSigEvent by auto

This commit is contained in:
lasconic 2013-03-13 18:15:36 +01:00
parent 94e97bd66b
commit 46068265e4
5 changed files with 17 additions and 20 deletions

View file

@ -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());

View file

@ -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);

View file

@ -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());
}

View file

@ -62,9 +62,6 @@ class SigEvent {
// SigList
//---------------------------------------------------------
typedef std::map<const int, SigEvent>::iterator iSigEvent;
typedef std::map<const int, SigEvent>::const_iterator ciSigEvent;
class TimeSigMap : public std::map<int, SigEvent > {
void normalize();

View file

@ -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);