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

pull/228/head
Ewan Higgs 8 years ago committed by Bret Curtis
parent 27a5c06f04
commit 38a2de3c51

@ -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());
std::unique_ptr<ESM::AiSequence::AiFollow> follow(new ESM::AiSequence::AiFollow());
follow->mData.mX = mX;
follow->mData.mY = mY;
follow->mData.mZ = mZ;

@ -73,7 +73,7 @@ MWWorld::Ptr AiPursue::getTarget() const
void AiPursue::writeState(ESM::AiSequence::AiSequence &sequence) const
{
std::auto_ptr<ESM::AiSequence::AiPursue> pursue(new ESM::AiSequence::AiPursue());
std::unique_ptr<ESM::AiSequence::AiPursue> pursue(new ESM::AiSequence::AiPursue());
pursue->mTargetActorId = mTargetActorId;
ESM::AiSequence::AiPackageContainer package;

@ -412,7 +412,7 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence)
for (std::vector<ESM::AiSequence::AiPackageContainer>::const_iterator it = sequence.mPackages.begin();
it != sequence.mPackages.end(); ++it)
{
std::auto_ptr<MWMechanics::AiPackage> package (NULL);
std::unique_ptr<MWMechanics::AiPackage> package (nullptr);
switch (it->mType)
{
case ESM::AiSequence::Ai_Wander:

@ -79,7 +79,7 @@ namespace MWMechanics
void AiTravel::writeState(ESM::AiSequence::AiSequence &sequence) const
{
std::auto_ptr<ESM::AiSequence::AiTravel> travel(new ESM::AiSequence::AiTravel());
std::unique_ptr<ESM::AiSequence::AiTravel> travel(new ESM::AiSequence::AiTravel());
travel->mData.mX = mX;
travel->mData.mY = mY;
travel->mData.mZ = mZ;

@ -919,7 +919,7 @@ namespace MWMechanics
else
remainingDuration = mDuration;
std::auto_ptr<ESM::AiSequence::AiWander> wander(new ESM::AiSequence::AiWander());
std::unique_ptr<ESM::AiSequence::AiWander> wander(new ESM::AiSequence::AiWander());
wander->mData.mDistance = mDistance;
wander->mData.mDuration = mDuration;
wander->mData.mTimeOfDay = mTimeOfDay;

@ -18,7 +18,7 @@ namespace MWPhysics
Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<const Resource::BulletShape> shape, btCollisionWorld* world)
: mCanWaterWalk(false), mWalkingOnWater(false)
, mCollisionObject(0), mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false)
, mCollisionObject(nullptr), mForce(0.f, 0.f, 0.f), mOnGround(false), mOnSlope(false)
, mInternalCollisionMode(true)
, mExternalCollisionMode(true)
, mCollisionWorld(world)

@ -162,10 +162,10 @@ namespace MWPhysics
bool mRotationallyInvariant;
std::auto_ptr<btCollisionShape> mShape;
std::unique_ptr<btCollisionShape> mShape;
btConvexShape* mConvexShape;
std::auto_ptr<btCollisionObject> mCollisionObject;
std::unique_ptr<btCollisionObject> mCollisionObject;
osg::Vec3f mMeshTranslation;
osg::Vec3f mHalfExtents;

@ -667,7 +667,7 @@ namespace MWPhysics
}
private:
std::auto_ptr<btCollisionObject> mCollisionObject;
std::unique_ptr<btCollisionObject> mCollisionObject;
osg::ref_ptr<Resource::BulletShapeInstance> mShapeInstance;
std::map<int, osg::NodePath> mRecIndexToNodePath;
bool mSolid;

@ -181,7 +181,7 @@ namespace MWPhysics
btCollisionDispatcher* mDispatcher;
btCollisionWorld* mCollisionWorld;
std::auto_ptr<Resource::BulletShapeManager> mShapeManager;
std::unique_ptr<Resource::BulletShapeManager> mShapeManager;
Resource::ResourceSystem* mResourceSystem;
typedef std::map<MWWorld::ConstPtr, Object*> ObjectMap;
@ -213,10 +213,10 @@ namespace MWPhysics
float mWaterHeight;
bool mWaterEnabled;
std::auto_ptr<btCollisionObject> mWaterCollisionObject;
std::auto_ptr<btCollisionShape> mWaterCollisionShape;
std::unique_ptr<btCollisionObject> mWaterCollisionObject;
std::unique_ptr<btCollisionShape> mWaterCollisionShape;
std::auto_ptr<MWRender::DebugDrawer> mDebugDrawer;
std::unique_ptr<MWRender::DebugDrawer> mDebugDrawer;
osg::ref_ptr<osg::Group> mParentNode;

@ -111,7 +111,7 @@ namespace MWRender
, mPosition(position)
, mLookAt(lookAt)
, mCharacter(character)
, mAnimation(NULL)
, mAnimation(nullptr)
, mSizeX(sizeX)
, mSizeY(sizeY)
{
@ -188,7 +188,7 @@ namespace MWRender
mParent->addChild(mCamera);
mCharacter.mCell = NULL;
mCharacter.mCell = nullptr;
}
CharacterPreview::~CharacterPreview ()

@ -109,7 +109,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
if (segment.mFogOfWarImage && segment.mHasFogState)
{
std::auto_ptr<ESM::FogState> fog (new ESM::FogState());
std::unique_ptr<ESM::FogState> fog (new ESM::FogState());
fog->mFogTextures.push_back(ESM::FogTexture());
segment.saveFogOfWar(fog->mFogTextures.back());
@ -126,7 +126,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
const int segsX = static_cast<int>(std::ceil(length.x() / mMapWorldSize));
const int segsY = static_cast<int>(std::ceil(length.y() / mMapWorldSize));
std::auto_ptr<ESM::FogState> fog (new ESM::FogState());
std::unique_ptr<ESM::FogState> fog (new ESM::FogState());
fog->mBounds.mMinX = mBounds.xMin();
fog->mBounds.mMaxX = mBounds.xMax();

@ -224,16 +224,16 @@ namespace MWRender
osg::ref_ptr<osg::Light> mSunLight;
std::auto_ptr<Pathgrid> mPathgrid;
std::auto_ptr<Objects> mObjects;
std::auto_ptr<Water> mWater;
std::auto_ptr<Terrain::World> mTerrain;
std::unique_ptr<Pathgrid> mPathgrid;
std::unique_ptr<Objects> mObjects;
std::unique_ptr<Water> mWater;
std::unique_ptr<Terrain::World> mTerrain;
TerrainStorage* mTerrainStorage;
std::auto_ptr<SkyManager> mSky;
std::auto_ptr<EffectManager> mEffectManager;
std::unique_ptr<SkyManager> mSky;
std::unique_ptr<EffectManager> mEffectManager;
osg::ref_ptr<NpcAnimation> mPlayerAnimation;
osg::ref_ptr<SceneUtil::PositionAttitudeTransform> mPlayerNode;
std::auto_ptr<Camera> mCamera;
std::unique_ptr<Camera> mCamera;
osg::Vec3f mCurrentCameraPos;
osg::ref_ptr<StateUpdater> mStateUpdater;

@ -189,9 +189,9 @@ namespace MWRender
osg::ref_ptr<AtmosphereUpdater> mAtmosphereUpdater;
std::auto_ptr<Sun> mSun;
std::auto_ptr<Moon> mMasser;
std::auto_ptr<Moon> mSecunda;
std::unique_ptr<Sun> mSun;
std::unique_ptr<Moon> mMasser;
std::unique_ptr<Moon> mSecunda;
osg::ref_ptr<osg::Group> mRainNode;
osg::ref_ptr<osgParticle::ParticleSystem> mRainParticleSystem;

@ -29,7 +29,7 @@ namespace MWRender
LandManager* getLandManager() const;
private:
std::auto_ptr<LandManager> mLandManager;
std::unique_ptr<LandManager> mLandManager;
Resource::ResourceSystem* mResourceSystem;
};

@ -58,7 +58,7 @@ namespace MWRender
const Fallback::Map* mFallback;
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
std::auto_ptr<RippleSimulation> mSimulation;
std::unique_ptr<RippleSimulation> mSimulation;
osg::ref_ptr<Refraction> mRefraction;
osg::ref_ptr<Reflection> mReflection;

@ -1,6 +1,5 @@
#include "ffmpeg_decoder.hpp"
// auto_ptr
#include <memory>
#include <stdexcept>

@ -217,7 +217,7 @@ private:
DecoderPtr mDecoder;
std::auto_ptr<Sound_Loudness> mLoudnessAnalyzer;
std::unique_ptr<Sound_Loudness> mLoudnessAnalyzer;
volatile bool mIsFinished;

@ -33,7 +33,7 @@ namespace MWSound
Environment mListenerEnv;
struct StreamThread;
std::auto_ptr<StreamThread> mStreamThread;
std::unique_ptr<StreamThread> mStreamThread;
void initCommon2D(ALuint source, const osg::Vec3f &pos, ALfloat gain, ALfloat pitch, bool loop, bool useenv);
void initCommon3D(ALuint source, const osg::Vec3f &pos, ALfloat mindist, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool loop, bool useenv);

@ -47,8 +47,7 @@ namespace MWSound
const VFS::Manager* mVFS;
Fallback::Map mFallback;
std::auto_ptr<Sound_Output> mOutput;
std::unique_ptr<Sound_Output> mOutput;
// Caches available music tracks by <playlist name, (sound files) >
std::map<std::string, std::vector<std::string> > mMusicFiles;
@ -66,8 +65,7 @@ namespace MWSound
float mNearWaterOutdoorTolerance;
std::string mNearWaterIndoorID;
std::string mNearWaterOutdoorID;
typedef std::auto_ptr<std::deque<Sound_Buffer> > SoundBufferList;
typedef std::unique_ptr<std::deque<Sound_Buffer> > SoundBufferList;
// List of sound buffers, grown as needed. New enties are added to the
// back, allowing existing Sound_Buffer references/pointers to remain
// valid.

@ -57,7 +57,7 @@ namespace MWWorld
bool mCellChanged;
MWPhysics::PhysicsSystem *mPhysics;
MWRender::RenderingManager& mRendering;
std::auto_ptr<CellPreloader> mPreloader;
std::unique_ptr<CellPreloader> mPreloader;
float mPreloadTimer;
int mHalfGridSize;
float mCellLoadingThreshold;

@ -294,7 +294,7 @@ namespace Compiler
{
// workaround for broken positioncell instructions.
/// \todo add option to disable this
std::auto_ptr<ErrorDowngrade> errorDowngrade (0);
std::unique_ptr<ErrorDowngrade> errorDowngrade (nullptr);
if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell")
errorDowngrade.reset (new ErrorDowngrade (getErrorHandler()));

@ -170,49 +170,49 @@ namespace AiSequence
{
case Ai_Wander:
{
std::auto_ptr<AiWander> ptr (new AiWander());
std::unique_ptr<AiWander> ptr (new AiWander());
ptr->load(esm);
mPackages.back().mPackage = ptr.release();
break;
}
case Ai_Travel:
{
std::auto_ptr<AiTravel> ptr (new AiTravel());
std::unique_ptr<AiTravel> ptr (new AiTravel());
ptr->load(esm);
mPackages.back().mPackage = ptr.release();
break;
}
case Ai_Escort:
{
std::auto_ptr<AiEscort> ptr (new AiEscort());
std::unique_ptr<AiEscort> ptr (new AiEscort());
ptr->load(esm);
mPackages.back().mPackage = ptr.release();
break;
}
case Ai_Follow:
{
std::auto_ptr<AiFollow> ptr (new AiFollow());
std::unique_ptr<AiFollow> ptr (new AiFollow());
ptr->load(esm);
mPackages.back().mPackage = ptr.release();
break;
}
case Ai_Activate:
{
std::auto_ptr<AiActivate> ptr (new AiActivate());
std::unique_ptr<AiActivate> ptr (new AiActivate());
ptr->load(esm);
mPackages.back().mPackage = ptr.release();
break;
}
case Ai_Combat:
{
std::auto_ptr<AiCombat> ptr (new AiCombat());
std::unique_ptr<AiCombat> ptr (new AiCombat());
ptr->load(esm);
mPackages.back().mPackage = ptr.release();
break;
}
case Ai_Pursue:
{
std::auto_ptr<AiPursue> ptr (new AiPursue());
std::unique_ptr<AiPursue> ptr (new AiPursue());
ptr->load(esm);
mPackages.back().mPackage = ptr.release();
break;

@ -18,7 +18,7 @@ void DataManager::setResourcePath(const std::string &path)
MyGUI::IDataStream *DataManager::getData(const std::string &name)
{
std::string fullpath = getDataPath(name);
std::auto_ptr<boost::filesystem::ifstream> stream;
std::unique_ptr<boost::filesystem::ifstream> stream;
stream.reset(new boost::filesystem::ifstream);
stream->open(fullpath, std::ios::binary);
if (stream->fail())

@ -75,7 +75,7 @@ osg::ref_ptr<Resource::BulletShape> BulletNifLoader::load(const Nif::NIFFilePtr
if (findBoundingBox(node))
{
std::auto_ptr<btCompoundShape> compound (new btCompoundShape);
std::unique_ptr<btCompoundShape> compound (new btCompoundShape);
btBoxShape* boxShape = new btBoxShape(getbtVector(mShape->mCollisionBoxHalfExtents));
btTransform transform = btTransform::getIdentity();

@ -28,8 +28,6 @@ namespace Resource
// this has to be defined in the .cpp file as we can't delete incomplete types
mResourceManagers.clear();
// no delete, all handled by auto_ptr
}
SceneManager* ResourceSystem::getSceneManager()

@ -57,10 +57,10 @@ namespace Resource
void reportStats(unsigned int frameNumber, osg::Stats* stats) const;
private:
std::auto_ptr<SceneManager> mSceneManager;
std::auto_ptr<ImageManager> mImageManager;
std::auto_ptr<NifFileManager> mNifFileManager;
std::auto_ptr<KeyframeManager> mKeyframeManager;
std::unique_ptr<SceneManager> mSceneManager;
std::unique_ptr<ImageManager> mImageManager;
std::unique_ptr<NifFileManager> mNifFileManager;
std::unique_ptr<KeyframeManager> mKeyframeManager;
// Store the base classes separately to get convenient access to the common interface
// Here users can register their own resourcemanager as well

@ -147,7 +147,7 @@ namespace Resource
private:
std::auto_ptr<Shader::ShaderManager> mShaderManager;
std::unique_ptr<Shader::ShaderManager> mShaderManager;
bool mForceShaders;
bool mClampLighting;
bool mForcePerPixelLighting;

@ -63,7 +63,7 @@ namespace SceneUtil
private:
// The root bone is not a "real" bone, it has no corresponding node in the scene graph.
// As far as the scene graph goes we support multiple root bones.
std::auto_ptr<Bone> mRootBone;
std::unique_ptr<Bone> mRootBone;
typedef std::map<std::string, std::pair<osg::NodePath, osg::MatrixTransform*> > BoneCache;
BoneCache mBoneCache;

@ -100,8 +100,8 @@ namespace Terrain
Resource::ResourceSystem* mResourceSystem;
std::auto_ptr<TextureManager> mTextureManager;
std::auto_ptr<ChunkManager> mChunkManager;
std::unique_ptr<TextureManager> mTextureManager;
std::unique_ptr<ChunkManager> mChunkManager;
};
}

@ -55,7 +55,7 @@ private:
};
std::auto_ptr<AudioResampler> mAudioResampler;
std::unique_ptr<AudioResampler> mAudioResampler;
uint8_t *mDataBuf;
uint8_t **mFrameData;

@ -78,7 +78,7 @@ namespace Video
private:
VideoState* mState;
std::auto_ptr<MovieAudioFactory> mAudioFactory;
std::unique_ptr<MovieAudioFactory> mAudioFactory;
};
}

@ -152,8 +152,8 @@ struct VideoState {
OpenThreads::Mutex pictq_mutex;
OpenThreads::Condition pictq_cond;
std::auto_ptr<ParseThread> parse_thread;
std::auto_ptr<VideoThread> video_thread;
std::unique_ptr<ParseThread> parse_thread;
std::unique_ptr<VideoThread> video_thread;
volatile bool mSeekRequested;
uint64_t mSeekPos;

Loading…
Cancel
Save