Move some objects instead of copying

macos_ci_fix
Andrei Kortunov 10 months ago
parent 1d207ed318
commit d3d7a663c6

@ -300,7 +300,7 @@ namespace ESSImport
ESM::CustomMarker marker;
marker.mWorldX = notepos[0];
marker.mWorldY = notepos[1];
marker.mNote = note;
marker.mNote = std::move(note);
marker.mCell = cell.mId;
mMarkers.push_back(marker);
}

@ -101,7 +101,7 @@ namespace ESSImport
if (esm.isNextSub("XNAM"))
mActorData.mSelectedEnchantItem = esm.getHString();
else
mActorData.mSelectedSpell = id;
mActorData.mSelectedSpell = std::move(id);
if (esm.isNextSub("YNAM"))
esm.skipHSub(); // 4 byte, 0

@ -418,7 +418,7 @@ void Launcher::SettingsPage::saveSettings()
void Launcher::SettingsPage::slotLoadedCellsChanged(QStringList cellNames)
{
loadCellsForAutocomplete(cellNames);
loadCellsForAutocomplete(std::move(cellNames));
}
void Launcher::SettingsPage::slotAnimSourcesToggled(bool checked)

@ -522,7 +522,6 @@ void MwIniImporter::importGameFiles(
multistrmap& cfg, const multistrmap& ini, const std::filesystem::path& iniFilename) const
{
std::vector<std::pair<std::time_t, std::filesystem::path>> contentFiles;
std::string baseGameFile("Game Files:GameFile");
std::time_t defaultTime = 0;
ToUTF8::Utf8Encoder encoder(mEncoding);
@ -538,7 +537,7 @@ void MwIniImporter::importGameFiles(
auto it = ini.begin();
for (int i = 0; it != ini.end(); i++)
{
std::string gameFile = baseGameFile;
std::string gameFile("Game Files:GameFile");
gameFile.append(std::to_string(i));
it = ini.find(gameFile);

@ -9,7 +9,7 @@ namespace CSMWorld
}
CSMFilter::NotNode::NotNode(std::shared_ptr<Node> child)
: UnaryNode(child, "not")
: UnaryNode(std::move(child), "not")
{
}

@ -3,7 +3,7 @@
#include <apps/opencs/model/filter/node.hpp>
CSMFilter::UnaryNode::UnaryNode(std::shared_ptr<Node> child, const std::string& name)
: mChild(child)
: mChild(std::move(child))
, mName(name)
{
}

@ -16,7 +16,7 @@
CSMPrefs::ColourSetting::ColourSetting(
Category* parent, QMutex* mutex, const std::string& key, const std::string& label, QColor default_)
: Setting(parent, mutex, key, label)
, mDefault(default_)
, mDefault(std::move(default_))
, mWidget(nullptr)
{
}

@ -12,7 +12,7 @@
#include "state.hpp"
CSMPrefs::StringSetting::StringSetting(
Category* parent, QMutex* mutex, const std::string& key, const std::string& label, std::string default_)
Category* parent, QMutex* mutex, const std::string& key, const std::string& label, std::string_view default_)
: Setting(parent, mutex, key, label)
, mDefault(default_)
, mWidget(nullptr)

@ -23,8 +23,8 @@ namespace CSMPrefs
QLineEdit* mWidget;
public:
StringSetting(
Category* parent, QMutex* mutex, const std::string& key, const std::string& label, std::string default_);
StringSetting(Category* parent, QMutex* mutex, const std::string& key, const std::string& label,
std::string_view default_);
StringSetting& setTooltip(const std::string& tooltip);

@ -533,7 +533,7 @@ namespace CSMWorld
auto& npc = dynamic_cast<const Record<ESM::NPC>&>(mReferenceables.getRecord(index)).get();
RaceDataPtr raceData = getRaceData(npc.mRace);
data->reset_data(id, "", false, !npc.isMale(), raceData);
data->reset_data(id, "", false, !npc.isMale(), std::move(raceData));
// Add head and hair
data->setPart(ESM::PRT_Head, npc.mHead, 0);

@ -154,7 +154,7 @@ namespace CSVRender
SceneWidget::SceneWidget(std::shared_ptr<Resource::ResourceSystem> resourceSystem, QWidget* parent,
Qt::WindowFlags f, bool retrieveInput)
: RenderWidget(parent, f)
, mResourceSystem(resourceSystem)
, mResourceSystem(std::move(resourceSystem))
, mLighting(nullptr)
, mHasDefaultAmbient(false)
, mIsExterior(true)
@ -225,7 +225,7 @@ namespace CSVRender
mResourceSystem->releaseGLObjects(mView->getCamera()->getGraphicsContext()->getState());
}
osg::ref_ptr<osg::Geometry> SceneWidget::createGradientRectangle(QColor bgColour, QColor gradientColour)
osg::ref_ptr<osg::Geometry> SceneWidget::createGradientRectangle(QColor& bgColour, QColor& gradientColour)
{
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
@ -266,7 +266,7 @@ namespace CSVRender
return geometry;
}
osg::ref_ptr<osg::Camera> SceneWidget::createGradientCamera(QColor bgColour, QColor gradientColour)
osg::ref_ptr<osg::Camera> SceneWidget::createGradientCamera(QColor& bgColour, QColor& gradientColour)
{
osg::ref_ptr<osg::Camera> camera = new osg::Camera();
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
@ -288,7 +288,7 @@ namespace CSVRender
return camera;
}
void SceneWidget::updateGradientCamera(QColor bgColour, QColor gradientColour)
void SceneWidget::updateGradientCamera(QColor& bgColour, QColor& gradientColour)
{
osg::ref_ptr<osg::Geometry> gradientRect = createGradientRectangle(bgColour, gradientColour);
// Replaces previous rectangle

@ -114,9 +114,9 @@ namespace CSVRender
void mouseMoveEvent(QMouseEvent* event) override;
void wheelEvent(QWheelEvent* event) override;
osg::ref_ptr<osg::Geometry> createGradientRectangle(QColor bgColour, QColor gradientColour);
osg::ref_ptr<osg::Camera> createGradientCamera(QColor bgColour, QColor gradientColour);
void updateGradientCamera(QColor bgColour, QColor gradientColour);
osg::ref_ptr<osg::Geometry> createGradientRectangle(QColor& bgColour, QColor& gradientColour);
osg::ref_ptr<osg::Camera> createGradientCamera(QColor& bgColour, QColor& gradientColour);
void updateGradientCamera(QColor& bgColour, QColor& gradientColour);
std::shared_ptr<Resource::ResourceSystem> mResourceSystem;

@ -666,7 +666,7 @@ void CSVRender::TerrainTextureMode::pushEditToCommand(CSMWorld::LandTexturesColu
undoStack.push(new CSMWorld::TouchLandCommand(landTable, ltexTable, cellId));
}
void CSVRender::TerrainTextureMode::createTexture(std::string textureFileName)
void CSVRender::TerrainTextureMode::createTexture(const std::string& textureFileName)
{
CSMDoc::Document& document = getWorldspaceWidget().getDocument();
@ -696,12 +696,10 @@ void CSVRender::TerrainTextureMode::createTexture(std::string textureFileName)
} while (freeIndexFound == false);
std::size_t idlocation = textureFileName.find("Texture: ");
textureFileName = textureFileName.substr(idlocation + 9);
QVariant textureNameVariant;
QString fileName = QString::fromStdString(textureFileName.substr(idlocation + 9));
QVariant textureFileNameVariant;
textureFileNameVariant.setValue(QString::fromStdString(textureFileName));
textureFileNameVariant.setValue(fileName);
undoStack.beginMacro("Add land texture record");
@ -712,7 +710,7 @@ void CSVRender::TerrainTextureMode::createTexture(std::string textureFileName)
mBrushTexture = newId;
}
bool CSVRender::TerrainTextureMode::allowLandTextureEditing(std::string cellId)
bool CSVRender::TerrainTextureMode::allowLandTextureEditing(const std::string& cellId)
{
CSMDoc::Document& document = getWorldspaceWidget().getDocument();
CSMWorld::IdTable& landTable
@ -840,5 +838,5 @@ void CSVRender::TerrainTextureMode::setBrushShape(CSVWidget::BrushShape brushSha
void CSVRender::TerrainTextureMode::setBrushTexture(std::string brushTexture)
{
mBrushTexture = brushTexture;
mBrushTexture = std::move(brushTexture);
}

@ -118,10 +118,10 @@ namespace CSVRender
CSMWorld::IdTable& landTable, std::string cellId);
/// \brief Create new land texture record from texture asset
void createTexture(std::string textureFileName);
void createTexture(const std::string& textureFileName);
/// \brief Create new cell and land if needed
bool allowLandTextureEditing(std::string textureFileName);
bool allowLandTextureEditing(const std::string& textureFileName);
std::string mCellId;
std::string mBrushTexture;

@ -19,7 +19,7 @@
#include "tableeditidaction.hpp"
#include "util.hpp"
CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document, CSMWorld::UniversalId id,
CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document, const CSMWorld::UniversalId& id,
CSMWorld::NestedTableProxyModel* model, QWidget* parent, bool editable, bool fixedRows)
: DragRecordTable(document, parent)
, mAddNewRowAction(nullptr)

@ -36,7 +36,7 @@ namespace CSVWorld
CSMWorld::CommandDispatcher* mDispatcher;
public:
NestedTable(CSMDoc::Document& document, CSMWorld::UniversalId id, CSMWorld::NestedTableProxyModel* model,
NestedTable(CSMDoc::Document& document, const CSMWorld::UniversalId& id, CSMWorld::NestedTableProxyModel* model,
QWidget* parent = nullptr, bool editable = true, bool fixedRows = false);
std::vector<CSMWorld::UniversalId> getDraggedRecords() const override;

@ -1283,11 +1283,11 @@ namespace MWGui
{
}
void showPage(TypesetBook::Ptr book, size_t page) override { mPageDisplay->showPage(book, page); }
void showPage(TypesetBook::Ptr book, size_t page) override { mPageDisplay->showPage(std::move(book), page); }
void adviseLinkClicked(std::function<void(InteractiveId)> linkClicked) override
{
mPageDisplay->mLinkClicked = linkClicked;
mPageDisplay->mLinkClicked = std::move(linkClicked);
}
void unadviseLinkClicked() override { mPageDisplay->mLinkClicked = std::function<void(InteractiveId)>(); }

@ -52,9 +52,9 @@ namespace
"Question_" + MyGUI::utility::toString(number) + "_AnswerThree") };
std::string sound = "vo\\misc\\chargen qa" + MyGUI::utility::toString(number) + ".wav";
Response r0 = { answer0, ESM::Class::Combat };
Response r1 = { answer1, ESM::Class::Magic };
Response r2 = { answer2, ESM::Class::Stealth };
Response r0 = { std::move(answer0), ESM::Class::Combat };
Response r1 = { std::move(answer1), ESM::Class::Magic };
Response r2 = { std::move(answer2), ESM::Class::Stealth };
// randomize order in which responses are displayed
int order = Misc::Rng::rollDice(6);

@ -328,7 +328,7 @@ namespace MWGui
mHistory->eventMouseWheel += MyGUI::newDelegate(this, &DialogueWindow::onMouseWheel);
BookPage::ClickCallback callback = [this](TypesetBook::InteractiveId link) { notifyLinkClicked(link); };
mHistory->adviseLinkClicked(callback);
mHistory->adviseLinkClicked(std::move(callback));
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord
+= MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);

@ -16,7 +16,7 @@ namespace
MWGui::BookTypesetter::Style* mBodyStyle;
AddContent(MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style)
: mTypesetter(typesetter)
: mTypesetter(std::move(typesetter))
, mBodyStyle(body_style)
{
}
@ -48,7 +48,7 @@ namespace
MWGui::BookTypesetter::Style* mBodyStyle;
AddEntry(MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style)
: mTypesetter(typesetter)
: mTypesetter(std::move(typesetter))
, mBodyStyle(body_style)
{
}
@ -68,7 +68,7 @@ namespace
AddJournalEntry(MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style,
MWGui::BookTypesetter::Style* header_style, bool add_header)
: AddEntry(typesetter, body_style)
: AddEntry(std::move(typesetter), body_style)
, mAddHeader(add_header)
, mHeaderStyle(header_style)
{
@ -95,7 +95,7 @@ namespace
AddTopicEntry(MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* body_style,
MWGui::BookTypesetter::Style* header_style, intptr_t contentId)
: AddEntry(typesetter, body_style)
: AddEntry(std::move(typesetter), body_style)
, mContentId(contentId)
, mHeaderStyle(header_style)
{
@ -118,7 +118,7 @@ namespace
struct AddTopicName : AddContent
{
AddTopicName(MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* style)
: AddContent(typesetter, style)
: AddContent(std::move(typesetter), style)
{
}
@ -132,7 +132,7 @@ namespace
struct AddQuestName : AddContent
{
AddQuestName(MWGui::BookTypesetter::Ptr typesetter, MWGui::BookTypesetter::Style* style)
: AddContent(typesetter, style)
: AddContent(std::move(typesetter), style)
{
}

@ -91,8 +91,8 @@ namespace
MWGui::BookPage* getPage(std::string_view name) { return getWidget<MWGui::BookPage>(name); }
JournalWindowImpl(MWGui::JournalViewModel::Ptr Model, bool questList, ToUTF8::FromType encoding)
: JournalBooks(Model, encoding)
JournalWindowImpl(MWGui::JournalViewModel::Ptr model, bool questList, ToUTF8::FromType encoding)
: JournalBooks(std::move(model), encoding)
, JournalWindow()
{
center();
@ -313,7 +313,7 @@ namespace
notifyTopics(getWidget<MyGUI::Widget>(TopicsList));
}
void pushBook(Book book, unsigned int page)
void pushBook(Book& book, unsigned int page)
{
DisplayState bs;
bs.mPage = page;
@ -323,7 +323,7 @@ namespace
updateCloseJournalButton();
}
void replaceBook(Book book, unsigned int page)
void replaceBook(Book& book, unsigned int page)
{
assert(!mStates.empty());
mStates.top().mBook = book;

@ -22,7 +22,7 @@ namespace MWGui
/// construct a new instance of the one JournalWindow implementation
static std::unique_ptr<JournalWindow> create(
std::shared_ptr<JournalViewModel> Model, bool questList, ToUTF8::FromType encoding);
std::shared_ptr<JournalViewModel> model, bool questList, ToUTF8::FromType encoding);
/// destroy this instance of the JournalWindow implementation
virtual ~JournalWindow() {}

@ -500,7 +500,7 @@ namespace MWGui
std::pair<MyGUI::TextBox*, MyGUI::TextBox*> widgets
= addValueItem(skill->mName, {}, "normal", coord1, coord2);
mSkillWidgetMap[skill->mId] = widgets;
mSkillWidgetMap[skill->mId] = std::move(widgets);
for (int i = 0; i < 2; ++i)
{

@ -71,7 +71,7 @@ namespace MWLua
template <class T>
void addRecordFunctionBinding(
sol::table table, const Context& context, const std::string& recordName = std::string(T::getRecordType()))
sol::table& table, const Context& context, const std::string& recordName = std::string(T::getRecordType()))
{
const MWWorld::Store<T>& store = MWBase::Environment::get().getESMStore()->get<T>();

@ -172,7 +172,7 @@ namespace MWRender
std::shared_ptr<float> mTimePtr;
public:
void setTimePtr(std::shared_ptr<float> time) { mTimePtr = time; }
void setTimePtr(std::shared_ptr<float> time) { mTimePtr = std::move(time); }
std::shared_ptr<float> getTimePtr() const { return mTimePtr; }
float getValue(osg::NodeVisitor* nv) override;

@ -21,8 +21,8 @@ namespace MWRender
auto luminanceFragment = shaderManager.getShader("luminance/luminance.frag", defines);
auto resolveFragment = shaderManager.getShader("luminance/resolve.frag", defines);
mResolveProgram = shaderManager.getProgram(vertex, resolveFragment);
mLuminanceProgram = shaderManager.getProgram(vertex, luminanceFragment);
mResolveProgram = shaderManager.getProgram(vertex, std::move(resolveFragment));
mLuminanceProgram = shaderManager.getProgram(vertex, std::move(luminanceFragment));
}
void LuminanceCalculator::compile()
@ -150,4 +150,4 @@ namespace MWRender
mCompiled = false;
}
}
}

@ -60,7 +60,7 @@ namespace MWRender
NavMeshMode mode)
: mId(id)
, mVersion(version)
, mNavMesh(navMesh)
, mNavMesh(std::move(navMesh))
, mGroupStateSet(groupStateSet)
, mDebugDrawStateSet(debugDrawStateSet)
, mSettings(settings)

@ -63,7 +63,7 @@ namespace MWWorld
public:
ResolutionHandle(std::shared_ptr<ResolutionListener> listener)
: mListener(listener)
: mListener(std::move(listener))
{
}
ResolutionHandle() = default;

@ -10,7 +10,7 @@
#include <components/esm3/esmreader.hpp>
#include <components/files/qtconversion.hpp>
ContentSelectorModel::ContentModel::ContentModel(QObject* parent, QIcon warningIcon, bool showOMWScripts)
ContentSelectorModel::ContentModel::ContentModel(QObject* parent, QIcon& warningIcon, bool showOMWScripts)
: QAbstractTableModel(parent)
, mWarningIcon(warningIcon)
, mShowOMWScripts(showOMWScripts)

@ -23,7 +23,7 @@ namespace ContentSelectorModel
{
Q_OBJECT
public:
explicit ContentModel(QObject* parent, QIcon warningIcon, bool showOMWScripts);
explicit ContentModel(QObject* parent, QIcon& warningIcon, bool showOMWScripts);
~ContentModel();
void setEncoding(const QString& encoding);

@ -12,7 +12,7 @@ QString ContentSelectorModel::EsmFile::sToolTip = QString(
<br/><b>Description:</b><br/>%5<br/> \
<br/><b>Dependencies: </b>%6<br/>");
ContentSelectorModel::EsmFile::EsmFile(QString fileName, ModelItem* parent)
ContentSelectorModel::EsmFile::EsmFile(const QString& fileName, ModelItem* parent)
: ModelItem(parent)
, mFileName(fileName)
{

@ -29,7 +29,7 @@ namespace ContentSelectorModel
FileProperty_GameFile = 6
};
EsmFile(QString fileName = QString(), ModelItem* parent = nullptr);
EsmFile(const QString& fileName = QString(), ModelItem* parent = nullptr);
// EsmFile(const EsmFile &);
~EsmFile() {}

@ -21,7 +21,7 @@ namespace ContentSelectorModel
: mErrorCode(ErrorCode_None)
{
}
inline LoadOrderError(ErrorCode errorCode, QString fileName)
inline LoadOrderError(ErrorCode errorCode, const QString& fileName)
: mErrorCode(errorCode)
, mFileName(fileName)
{

@ -22,7 +22,7 @@ namespace ESM
if (mList.empty())
Log(Debug::Warning) << "Encountered DNAM record without DODT record, skipped.";
else
mList.back().mCellName = name;
mList.back().mCellName = std::move(name);
}
}

@ -264,6 +264,6 @@ void Fallback::validate(boost::any& v, std::vector<std::string> const& tokens, F
std::string key(token.substr(0, sep));
std::string value(token.substr(sep + 1));
map->mMap[key] = value;
map->mMap[key] = std::move(value);
}
}

@ -408,7 +408,7 @@ namespace Gui
file.reset();
// Create the font texture
std::string bitmapFilename = "fonts/" + std::string(name) + ".tex";
std::string bitmapFilename = "fonts/" + std::move(name) + ".tex";
Files::IStreamPtr bitmapFile = mVFS->get(bitmapFilename);

@ -95,7 +95,10 @@ namespace fx
mData.get<WeatherTransition>() = transition > 0 ? 1 - transition : 0;
}
void bindPointLights(std::shared_ptr<SceneUtil::PPLightBuffer> buffer) { mPointLightBuffer = buffer; }
void bindPointLights(std::shared_ptr<SceneUtil::PPLightBuffer> buffer)
{
mPointLightBuffer = std::move(buffer);
}
static std::string getStructDefinition()
{

@ -29,12 +29,12 @@ namespace SceneUtil
void Controller::setSource(std::shared_ptr<ControllerSource> source)
{
mSource = source;
mSource = std::move(source);
}
void Controller::setFunction(std::shared_ptr<ControllerFunction> function)
{
mFunction = function;
mFunction = std::move(function);
}
std::shared_ptr<ControllerSource> Controller::getSource() const
@ -105,7 +105,7 @@ namespace SceneUtil
AssignControllerSourcesVisitor::AssignControllerSourcesVisitor(std::shared_ptr<ControllerSource> toAssign)
: ControllerVisitor()
, mToAssign(toAssign)
, mToAssign(std::move(toAssign))
{
}
@ -121,7 +121,7 @@ namespace SceneUtil
}
ForceControllerSourcesVisitor::ForceControllerSourcesVisitor(std::shared_ptr<ControllerSource> toAssign)
: AssignControllerSourcesVisitor(toAssign)
: AssignControllerSourcesVisitor(std::move(toAssign))
{
}

@ -192,7 +192,7 @@ namespace SceneUtil
}
osg::MatrixList mtxList
= root->getWorldMatrices(root); // We always assume that RigGeometries have origin at their root
geom->computeMatrixFromRootSkeleton(mtxList);
geom->computeMatrixFromRootSkeleton(std::move(mtxList));
if (mIsBodyPart && mBackToOrigin)
updateBackToOriginTransform(geom);

@ -105,7 +105,7 @@ namespace SceneUtil
const std::string& screenshotFormat, std::function<void(std::string)> callback)
: mScreenshotPath(screenshotPath)
, mScreenshotFormat(screenshotFormat)
, mCallback(callback)
, mCallback(std::move(callback))
{
}

@ -348,7 +348,7 @@ namespace Stereo
void Manager::setUpdateViewCallback(std::shared_ptr<UpdateViewCallback> cb)
{
mUpdateViewCallback = cb;
mUpdateViewCallback = std::move(cb);
}
void Manager::setCullCallback(osg::ref_ptr<osg::NodeCallback> cb)
@ -382,7 +382,7 @@ namespace Stereo
return sStereoEnabled;
}
Manager::CustomViewCallback::CustomViewCallback(View left, View right)
Manager::CustomViewCallback::CustomViewCallback(View& left, View& right)
: mLeft(left)
, mRight(right)
{

@ -59,7 +59,7 @@ namespace Stereo
struct CustomViewCallback : public UpdateViewCallback
{
public:
CustomViewCallback(View left, View right);
CustomViewCallback(View& left, View& right);
void updateView(View& left, View& right) override;

Loading…
Cancel
Save