Commit 38a2de3c authored by Ewan Higgs's avatar Ewan Higgs Committed by psi29a

convert std::autor_ptr to std::unique_ptr, originally by Ewan Higgs and updated by Bret Curtis

parent 27a5c06f
......@@ -47,7 +47,7 @@ namespace CS
Q_OBJECT
// FIXME: should be moved to document, so we can have different resources for each opened project
std::auto_ptr<VFS::Manager> mVFS;
std::unique_ptr<VFS::Manager> mVFS;
Files::ConfigurationManager mCfgMgr;
CSMPrefs::State mSettingsState;
......
......@@ -415,9 +415,9 @@ void CSMDoc::Document::runSearch (const CSMWorld::UniversalId& searchId, const C
emit stateChanged (getState(), this);
}
void CSMDoc::Document::runMerge (std::auto_ptr<CSMDoc::Document> target)
void CSMDoc::Document::runMerge (std::unique_ptr<CSMDoc::Document> target)
{
mTools.runMerge (target);
mTools.runMerge (std::move(target));
emit stateChanged (getState(), this);
}
......
......@@ -137,7 +137,7 @@ namespace CSMDoc
void runSearch (const CSMWorld::UniversalId& searchId, const CSMTools::Search& search);
void runMerge (std::auto_ptr<CSMDoc::Document> target);
void runMerge (std::unique_ptr<CSMDoc::Document> target);
void abortOperation (int type);
......
......@@ -45,9 +45,9 @@ CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::Fr
appendStage (new FinishMergedDocumentStage (mState, encoding));
}
void CSMTools::MergeOperation::setTarget (std::auto_ptr<CSMDoc::Document> document)
void CSMTools::MergeOperation::setTarget (std::unique_ptr<CSMDoc::Document> document)
{
mState.mTarget = document;
mState.mTarget = std::move(document);
}
void CSMTools::MergeOperation::operationDone()
......
......@@ -27,7 +27,7 @@ namespace CSMTools
MergeOperation (CSMDoc::Document& document, ToUTF8::FromType encoding);
/// \attention Do not call this function while a merge is running.
void setTarget (std::auto_ptr<CSMDoc::Document> document);
void setTarget (std::unique_ptr<CSMDoc::Document> document);
protected slots:
......
......@@ -12,7 +12,7 @@ namespace CSMTools
{
struct MergeState
{
std::auto_ptr<CSMDoc::Document> mTarget;
std::unique_ptr<CSMDoc::Document> mTarget;
CSMDoc::Document& mSource;
bool mCompleted;
std::map<std::pair<uint16_t, int>, int> mTextureIndices; // (texture, content file) -> new texture
......
......@@ -216,7 +216,7 @@ void CSMTools::Tools::runSearch (const CSMWorld::UniversalId& searchId, const Se
mSearch.start();
}
void CSMTools::Tools::runMerge (std::auto_ptr<CSMDoc::Document> target)
void CSMTools::Tools::runMerge (std::unique_ptr<CSMDoc::Document> target)
{
// not setting an active report, because merge does not produce messages
......@@ -230,7 +230,7 @@ void CSMTools::Tools::runMerge (std::auto_ptr<CSMDoc::Document> target)
target->flagAsDirty();
mMergeOperation->setTarget (target);
mMergeOperation->setTarget (std::move(target));
mMerge.start();
}
......
......@@ -77,7 +77,7 @@ namespace CSMTools
void runSearch (const CSMWorld::UniversalId& searchId, const Search& search);
void runMerge (std::auto_ptr<CSMDoc::Document> target);
void runMerge (std::unique_ptr<CSMDoc::Document> target);
void abortOperation (int type);
///< \attention The operation is not aborted immediately.
......
......@@ -138,7 +138,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons
if (mLocked)
return;
std::auto_ptr<CSMWorld::UpdateCellCommand> modifyCell;
std::unique_ptr<CSMWorld::UpdateCellCommand> modifyCell;
int columnId = model->data (index, ColumnBase::Role_ColumnId).toInt();
......@@ -167,7 +167,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons
}
}
std::auto_ptr<CSMWorld::ModifyCommand> modifyData (
std::unique_ptr<CSMWorld::ModifyCommand> modifyData (
new CSMWorld::ModifyCommand (*model, index, new_));
if (modifyCell.get())
......
......@@ -808,7 +808,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
const std::string& destination,
const CSMWorld::UniversalId::Type type)
{
std::auto_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy());
std::unique_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy());
mAdapters.find(type)->second->setId(*newRecord, destination);
mData.insertRecord(*newRecord, type, destination);
}
......
......@@ -389,7 +389,7 @@ void CSMWorld::RefIdData::copyTo (int index, RefIdData& target) const
std::string id = source->getId (localIndex.first);
std::auto_ptr<CSMWorld::RecordBase> newRecord (source->getRecord (localIndex.first).modifiedCopy());
std::unique_ptr<CSMWorld::RecordBase> newRecord (source->getRecord (localIndex.first).modifiedCopy());
target.insertRecord (*newRecord, localIndex.second, id);
}
......@@ -62,7 +62,7 @@ bool CSVRender::Cell::addObjects (int start, int end)
{
std::string id = Misc::StringUtils::lowerCase (collection.getRecord (i).get().mId);
std::auto_ptr<Object> object (new Object (mData, mCellNode, id, false));
std::unique_ptr<Object> object (new Object (mData, mCellNode, id, false));
if (mSubModeElementMask & Mask_Reference)
object->setSubMode (mSubMode);
......
......@@ -47,13 +47,13 @@ namespace CSVRender
std::string mId;
osg::ref_ptr<osg::Group> mCellNode;
std::map<std::string, Object *> mObjects;
std::auto_ptr<Terrain::TerrainGrid> mTerrain;
std::unique_ptr<Terrain::TerrainGrid> mTerrain;
CSMWorld::CellCoordinates mCoordinates;
std::auto_ptr<CellArrow> mCellArrows[4];
std::auto_ptr<CellMarker> mCellMarker;
std::auto_ptr<CellBorder> mCellBorder;
std::auto_ptr<CellWater> mCellWater;
std::auto_ptr<Pathgrid> mPathgrid;
std::unique_ptr<CellArrow> mCellArrows[4];
std::unique_ptr<CellMarker> mCellMarker;
std::unique_ptr<CellBorder> mCellBorder;
std::unique_ptr<CellWater> mCellWater;
std::unique_ptr<Pathgrid> mPathgrid;
bool mDeleted;
int mSubMode;
unsigned int mSubModeElementMask;
......
......@@ -559,7 +559,7 @@ void CSVRender::InstanceMode::dropEvent (QDropEvent* event)
if (mode=="Create cell and insert")
{
std::auto_ptr<CSMWorld::CreateCommand> createCommand (
std::unique_ptr<CSMWorld::CreateCommand> createCommand (
new CSMWorld::CreateCommand (cellTable, cellId));
int parentIndex = cellTable.findColumnIndex (CSMWorld::Columns::ColumnId_Cell);
......@@ -610,7 +610,7 @@ void CSVRender::InstanceMode::dropEvent (QDropEvent* event)
if (mime->isReferencable (iter->getType()))
{
// create reference
std::auto_ptr<CSMWorld::CreateCommand> createCommand (
std::unique_ptr<CSMWorld::CreateCommand> createCommand (
new CSMWorld::CreateCommand (
referencesTable, document.getData().getReferences().getNewId()));
......
......@@ -54,7 +54,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
{
modified = true;
std::auto_ptr<Cell> cell (new Cell (mDocument.getData(), mRootNode,
std::unique_ptr<Cell> cell (new Cell (mDocument.getData(), mRootNode,
iter->first.getId (mWorldspace), deleted));
delete iter->second;
......@@ -378,7 +378,7 @@ void CSVRender::PagedWorldspaceWidget::addCellToScene (
bool deleted = index==-1 ||
cells.getRecord (index).mState==CSMWorld::RecordBase::State_Deleted;
std::auto_ptr<Cell> cell (
std::unique_ptr<Cell> cell (
new Cell (mDocument.getData(), mRootNode, coordinates.getId (mWorldspace),
deleted));
EditMode *editMode = getEditMode();
......
......@@ -29,7 +29,7 @@ namespace CSVRender
std::string mCellId;
CSMWorld::IdTable *mCellsModel;
CSMWorld::IdTable *mReferenceablesModel;
std::auto_ptr<Cell> mCell;
std::unique_ptr<Cell> mCell;
void update();
......
......@@ -127,10 +127,10 @@ void CSVTools::Merge::accept()
{
std::vector< boost::filesystem::path > files (1, mAdjuster->getPath());
std::auto_ptr<CSMDoc::Document> target (
std::unique_ptr<CSMDoc::Document> target (
mDocumentManager.makeDocument (files, files[0], true));
mDocument->runMerge (target);
mDocument->runMerge (std::move(target));
hide();
}
......
......@@ -91,7 +91,7 @@ namespace CSVWorld
Creator *CreatorFactory<CreatorT, scope>::makeCreator (CSMDoc::Document& document,
const CSMWorld::UniversalId& id) const
{
std::auto_ptr<CreatorT> creator (new CreatorT (document.getData(), document.getUndoStack(), id));
std::unique_ptr<CreatorT> creator (new CreatorT (document.getData(), document.getUndoStack(), id));
creator->setScope (scope);
......
......@@ -120,7 +120,7 @@ mIndex(index)
CSVWorld::DialogueDelegateDispatcherProxy::DialogueDelegateDispatcherProxy(QWidget* editor, CSMWorld::ColumnBase::Display display) :
mEditor(editor),
mDisplay(display),
mIndexWrapper(NULL)
mIndexWrapper(nullptr)
{
}
......
......@@ -84,7 +84,7 @@ namespace CSVWorld
CSMWorld::ColumnBase::Display mDisplay;
std::auto_ptr<refWrapper> mIndexWrapper;
std::unique_ptr<refWrapper> mIndexWrapper;
public:
DialogueDelegateDispatcherProxy(QWidget* editor,
......
......@@ -63,7 +63,7 @@ std::string CSVWorld::GenericCreator::getIdValidatorResult() const
void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const {}
void CSVWorld::GenericCreator::pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command,
void CSVWorld::GenericCreator::pushCommand (std::unique_ptr<CSMWorld::CreateCommand> command,
const std::string& id)
{
mUndoStack.push (command.release());
......@@ -224,7 +224,7 @@ void CSVWorld::GenericCreator::create()
{
std::string id = getId();
std::auto_ptr<CSMWorld::CreateCommand> command;
std::unique_ptr<CSMWorld::CreateCommand> command;
if (mCloneMode)
{
......@@ -239,7 +239,7 @@ void CSVWorld::GenericCreator::create()
}
configureCreateCommand (*command);
pushCommand (command, id);
pushCommand (std::move(command), id);
emit done();
emit requestFocus(id);
......
......@@ -71,7 +71,7 @@ namespace CSVWorld
/// Allow subclasses to wrap the create command together with additional commands
/// into a macro.
virtual void pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command,
virtual void pushCommand (std::unique_ptr<CSMWorld::CreateCommand> command,
const std::string& id);
CSMWorld::Data& getData() const;
......
......@@ -71,8 +71,8 @@ namespace OMW
class Engine
{
SDL_Window* mWindow;
std::auto_ptr<VFS::Manager> mVFS;
std::auto_ptr<Resource::ResourceSystem> mResourceSystem;
std::unique_ptr<VFS::Manager> mVFS;
std::unique_ptr<Resource::ResourceSystem> mResourceSystem;
osg::ref_ptr<SceneUtil::WorkQueue> mWorkQueue;
MWBase::Environment mEnvironment;
ToUTF8::FromType mEncoding;
......
......@@ -310,7 +310,7 @@ int main(int argc, char**argv)
boost::filesystem::ofstream logfile;
std::auto_ptr<OMW::Engine> engine;
std::unique_ptr<OMW::Engine> engine;
int ret = 0;
try
......
......@@ -52,7 +52,7 @@ namespace MWClass
{
if (!ptr.getRefData().getCustomData())
{
std::auto_ptr<ContainerCustomData> data (new ContainerCustomData);
std::unique_ptr<ContainerCustomData> data (new ContainerCustomData);
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
......@@ -308,7 +308,7 @@ namespace MWClass
if (!ptr.getRefData().getCustomData())
{
// Create a CustomData, but don't fill it from ESM records (not needed)
std::auto_ptr<ContainerCustomData> data (new ContainerCustomData);
std::unique_ptr<ContainerCustomData> data (new ContainerCustomData);
ptr.getRefData().setCustomData (data.release());
}
......
......@@ -108,7 +108,7 @@ namespace MWClass
{
if (!ptr.getRefData().getCustomData())
{
std::auto_ptr<CreatureCustomData> data (new CreatureCustomData);
std::unique_ptr<CreatureCustomData> data (new CreatureCustomData);
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
......@@ -742,7 +742,7 @@ namespace MWClass
if (!ptr.getRefData().getCustomData())
{
// Create a CustomData, but don't fill it from ESM records (not needed)
std::auto_ptr<CreatureCustomData> data (new CreatureCustomData);
std::unique_ptr<CreatureCustomData> data (new CreatureCustomData);
if (hasInventoryStore(ptr))
data->mContainerStore = new MWWorld::InventoryStore();
......
......@@ -132,7 +132,7 @@ namespace MWClass
{
if (!ptr.getRefData().getCustomData())
{
std::auto_ptr<CreatureLevListCustomData> data (new CreatureLevListCustomData);
std::unique_ptr<CreatureLevListCustomData> data (new CreatureLevListCustomData);
data->mSpawnActorId = -1;
data->mSpawn = true;
......
......@@ -350,7 +350,7 @@ namespace MWClass
{
if (!ptr.getRefData().getCustomData())
{
std::auto_ptr<DoorCustomData> data(new DoorCustomData);
std::unique_ptr<DoorCustomData> data(new DoorCustomData);
data->mDoorState = 0;
ptr.getRefData().setCustomData(data.release());
......
......@@ -303,7 +303,7 @@ namespace MWClass
{
if (!ptr.getRefData().getCustomData())
{
std::auto_ptr<NpcCustomData> data(new NpcCustomData);
std::unique_ptr<NpcCustomData> data(new NpcCustomData);
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
......@@ -1259,7 +1259,7 @@ namespace MWClass
if (!ptr.getRefData().getCustomData())
{
// Create a CustomData, but don't fill it from ESM records (not needed)
std::auto_ptr<NpcCustomData> data (new NpcCustomData);
std::unique_ptr<NpcCustomData> data (new NpcCustomData);
ptr.getRefData().setCustomData (data.release());
}
}
......
......@@ -3,6 +3,8 @@
#include <vector>
#include "../mwmechanics/alchemy.hpp"
#include "widgets.hpp"
#include "windowbase.hpp"
......@@ -48,7 +50,7 @@ namespace MWGui
void update();
std::auto_ptr<MWMechanics::Alchemy> mAlchemy;
std::unique_ptr<MWMechanics::Alchemy> mAlchemy;
std::vector<ItemWidget*> mApparatus;
std::vector<ItemWidget*> mIngredients;
......
......@@ -5,6 +5,7 @@
#include "mode.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwrender/characterpreview.hpp"
namespace osg
{
......@@ -16,11 +17,6 @@ namespace Resource
class ResourceSystem;
}
namespace MWRender
{
class InventoryPreview;
}
namespace MWGui
{
namespace Widgets
......@@ -101,8 +97,8 @@ namespace MWGui
int mLastXSize;
int mLastYSize;
std::auto_ptr<MyGUI::ITexture> mPreviewTexture;
std::auto_ptr<MWRender::InventoryPreview> mPreview;
std::unique_ptr<MyGUI::ITexture> mPreviewTexture;
std::unique_ptr<MWRender::InventoryPreview> mPreview;
bool mTrading;
......
......@@ -69,7 +69,7 @@ namespace MWGui
typedef std::vector<Line> Lines;
Lines mLines;
std::auto_ptr<ItemModel> mModel;
std::unique_ptr<ItemModel> mModel;
MyGUI::ScrollView* mScrollView;
DisplayMode mDisplayMode;
};
......
......@@ -76,7 +76,7 @@ namespace MWGui
// TODO: add releaseGLObjects() for mTexture
osg::ref_ptr<osg::Texture2D> mTexture;
std::auto_ptr<MyGUI::ITexture> mGuiTexture;
std::unique_ptr<MyGUI::ITexture> mGuiTexture;
void changeWallpaper();
......
......@@ -247,8 +247,8 @@ namespace MWGui
void setGlobalMapMarkerTooltip(MyGUI::Widget* widget, int x, int y);
MyGUI::ScrollView* mGlobalMap;
std::auto_ptr<MyGUI::ITexture> mGlobalMapTexture;
std::auto_ptr<MyGUI::ITexture> mGlobalMapOverlayTexture;
std::unique_ptr<MyGUI::ITexture> mGlobalMapTexture;
std::unique_ptr<MyGUI::ITexture> mGlobalMapOverlayTexture;
MyGUI::ImageBox* mGlobalMapImage;
MyGUI::ImageBox* mGlobalMapOverlay;
MyGUI::ImageBox* mPlayerArrowLocal;
......
......@@ -2,6 +2,7 @@
#define MWGUI_RACE_H
#include "windowbase.hpp"
#include <MyGUI_RenderManager.h>
namespace MWGui
......@@ -115,8 +116,8 @@ namespace MWGui
float mCurrentAngle;
std::auto_ptr<MWRender::RaceSelectionPreview> mPreview;
std::auto_ptr<MyGUI::ITexture> mPreviewTexture;
std::unique_ptr<MWRender::RaceSelectionPreview> mPreview;
std::unique_ptr<MyGUI::ITexture> mPreviewTexture;
bool mPreviewDirty;
};
......
......@@ -48,7 +48,7 @@ namespace MWGui
void fillSaveList();
std::auto_ptr<MyGUI::ITexture> mScreenshotTexture;
std::unique_ptr<MyGUI::ITexture> mScreenshotTexture;
MyGUI::ImageBox* mScreenshot;
bool mSaving;
......
......@@ -56,7 +56,7 @@ namespace MWGui
private:
MyGUI::ScrollView* mScrollView;
std::auto_ptr<SpellModel> mModel;
std::unique_ptr<SpellModel> mModel;
/// tracks a row in the spell view
struct LineInfo
......
......@@ -51,8 +51,8 @@ namespace MWGui
private:
const VFS::Manager* mVFS;
std::auto_ptr<MyGUI::ITexture> mTexture;
std::auto_ptr<Video::VideoPlayer> mPlayer;
std::unique_ptr<MyGUI::ITexture> mTexture;
std::unique_ptr<Video::VideoPlayer> mPlayer;
};
}
......
......@@ -397,7 +397,7 @@ namespace MWGui
osgMyGUI::Platform* mGuiPlatform;
osgViewer::Viewer* mViewer;
std::auto_ptr<Gui::FontLoader> mFontLoader;
std::unique_ptr<Gui::FontLoader> mFontLoader;
bool mConsoleOnlyScripts;
......
......@@ -32,7 +32,7 @@ namespace MWMechanics
AiState& getAiState();
private:
std::auto_ptr<CharacterController> mCharacterController;
std::unique_ptr<CharacterController> mCharacterController;
AiState mAiState;
};
......
......@@ -55,7 +55,7 @@ namespace MWMechanics
void AiActivate::writeState(ESM::AiSequence::AiSequence &sequence) const
{
std::auto_ptr<ESM::AiSequence::AiActivate> activate(new ESM::AiSequence::AiActivate());
std::unique_ptr<ESM::AiSequence::AiActivate> activate(new ESM::AiSequence::AiActivate());
activate->mTargetId = mObjectId;
ESM::AiSequence::AiPackageContainer package;
......
......@@ -479,7 +479,7 @@ namespace MWMechanics
void AiCombat::writeState(ESM::AiSequence::AiSequence &sequence) const
{
std::auto_ptr<ESM::AiSequence::AiCombat> combat(new ESM::AiSequence::AiCombat());
std::unique_ptr<ESM::AiSequence::AiCombat> combat(new ESM::AiSequence::AiCombat());
combat->mTargetActorId = mTargetActorId;
ESM::AiSequence::AiPackageContainer package;
......
......@@ -126,7 +126,7 @@ namespace MWMechanics
void AiEscort::writeState(ESM::AiSequence::AiSequence &sequence) const
{
std::auto_ptr<ESM::AiSequence::AiEscort> escort(new ESM::AiSequence::AiEscort());
std::unique_ptr<ESM::AiSequence::AiEscort> escort(new ESM::AiSequence::AiEscort());
escort->mData.mX = mX;
escort->mData.mY = mY;
escort->mData.mZ = mZ;
......
......@@ -188,7 +188,7 @@ bool AiFollow::isCommanded() const
void AiFollow::writeState(ESM::AiSequence::AiSequence &sequence) const
{
std::auto_ptr<ESM::AiSequence::AiFollow> follow(new ESM::AiSequence::AiFollow());