Use move semantics for tools

ini_importer_tests
Andrei Kortunov 11 months ago
parent a41259cca8
commit 737d3b499b

@ -85,7 +85,7 @@ namespace ESSImport
Misc::StringUtils::lowerCaseInPlace(group); Misc::StringUtils::lowerCaseInPlace(group);
ESM::AnimationState::ScriptedAnimation scriptedAnim; ESM::AnimationState::ScriptedAnimation scriptedAnim;
scriptedAnim.mGroup = group; scriptedAnim.mGroup = std::move(group);
scriptedAnim.mTime = anis.mTime; scriptedAnim.mTime = anis.mTime;
scriptedAnim.mAbsolute = true; scriptedAnim.mAbsolute = true;
// Neither loop count nor queueing seems to be supported by the ess format. // Neither loop count nor queueing seems to be supported by the ess format.

@ -306,12 +306,12 @@ namespace ESSImport
mMarkers.push_back(marker); mMarkers.push_back(marker);
} }
newcell.mRefs = cellrefs; newcell.mRefs = std::move(cellrefs);
if (cell.isExterior()) if (cell.isExterior())
mExtCells[std::make_pair(cell.mData.mX, cell.mData.mY)] = newcell; mExtCells[std::make_pair(cell.mData.mX, cell.mData.mY)] = std::move(newcell);
else else
mIntCells[cell.mName] = newcell; mIntCells[cell.mName] = std::move(newcell);
} }
void ConvertCell::writeCell(const Cell& cell, ESM::ESMWriter& esm) void ConvertCell::writeCell(const Cell& cell, ESM::ESMWriter& esm)

@ -624,7 +624,7 @@ bool CSMFilter::Parser::parse(const std::string& filter, bool allowPredefined)
} }
if (node) if (node)
mFilter = node; mFilter = std::move(node);
else else
{ {
// Empty filter string equals to filter "true". // Empty filter string equals to filter "true".

@ -171,7 +171,7 @@ void CSMTools::ReportModel::flagAsReplaced(int index)
hint[0] = 'r'; hint[0] = 'r';
line.mHint = hint; line.mHint = std::move(hint);
emit dataChanged(this->index(index, 0), this->index(index, columnCount())); emit dataChanged(this->index(index, 0), this->index(index, columnCount()));
} }

@ -468,13 +468,13 @@ namespace CSMWorld
if (type == UniversalId::Type_Creature) if (type == UniversalId::Type_Creature)
{ {
// Valid creature record // Valid creature record
setupCreature(id, data); setupCreature(id, std::move(data));
emit actorChanged(id); emit actorChanged(id);
} }
else if (type == UniversalId::Type_Npc) else if (type == UniversalId::Type_Npc)
{ {
// Valid npc record // Valid npc record
setupNpc(id, data); setupNpc(id, std::move(data));
emit actorChanged(id); emit actorChanged(id);
} }
else else
@ -665,7 +665,7 @@ namespace CSMWorld
RaceDataPtr data = mCachedRaces.get(race); RaceDataPtr data = mCachedRaces.get(race);
if (data) if (data)
{ {
setupRace(race, data); setupRace(race, std::move(data));
// Race was changed. Need to mark actor dependencies as dirty. // Race was changed. Need to mark actor dependencies as dirty.
// Cannot use markDirtyDependency because that would invalidate // Cannot use markDirtyDependency because that would invalidate
// the current iterator. // the current iterator.
@ -683,7 +683,7 @@ namespace CSMWorld
ActorDataPtr data = mCachedActors.get(actor); ActorDataPtr data = mCachedActors.get(actor);
if (data) if (data)
{ {
setupActor(actor, data); setupActor(actor, std::move(data));
} }
} }
mDirtyActors.clear(); mDirtyActors.clear();

@ -504,7 +504,7 @@ namespace CSMWorld
auto record2 = std::make_unique<Record<ESXRecordT>>(); auto record2 = std::make_unique<Record<ESXRecordT>>();
record2->mState = Record<ESXRecordT>::State_ModifiedOnly; record2->mState = Record<ESXRecordT>::State_ModifiedOnly;
record2->mModified = record; record2->mModified = std::move(record);
insertRecord(std::move(record2), getAppendIndex(id, type), type); insertRecord(std::move(record2), getAppendIndex(id, type), type);
} }

@ -195,7 +195,7 @@ void CSVWorld::TableSubView::createFilterRequest(std::vector<CSMWorld::Universal
CSVFilter::FilterData filterData; CSVFilter::FilterData filterData;
filterData.searchData = qData; filterData.searchData = qData;
filterData.columns = searchColumns; filterData.columns = std::move(searchColumns);
sourceFilterByValue.emplace_back(filterData); sourceFilterByValue.emplace_back(filterData);

@ -810,8 +810,7 @@ bool Wizard::UnshieldWorker::extractFile(
if (!dir.mkpath(path)) if (!dir.mkpath(path))
return false; return false;
QString fileName(path); path.append(QString::fromUtf8(unshield_file_name(unshield, index)));
fileName.append(QString::fromUtf8(unshield_file_name(unshield, index)));
// Calculate the percentage done // Calculate the percentage done
int progress = (((float)counter / (float)unshield_file_count(unshield)) * 100); int progress = (((float)counter / (float)unshield_file_count(unshield)) * 100);
@ -825,13 +824,13 @@ bool Wizard::UnshieldWorker::extractFile(
emit textChanged(tr("Extracting: %1").arg(QString::fromUtf8(unshield_file_name(unshield, index)))); emit textChanged(tr("Extracting: %1").arg(QString::fromUtf8(unshield_file_name(unshield, index))));
emit progressChanged(progress); emit progressChanged(progress);
QByteArray array(fileName.toUtf8()); QByteArray array(path.toUtf8());
success = unshield_file_save(unshield, index, array.constData()); success = unshield_file_save(unshield, index, array.constData());
if (!success) if (!success)
{ {
qDebug() << "error"; qDebug() << "error";
dir.remove(fileName); dir.remove(path);
} }
return success; return success;

Loading…
Cancel
Save