From: tbaudier Date: Thu, 20 Apr 2017 14:25:20 +0000 (+0200) Subject: Change auto_ptr to shared_ptr with c++11 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=93f793e07c285d87a02d72864cf11c13adf4a304;p=clitk.git Change auto_ptr to shared_ptr with c++11 Avoid warnings --- diff --git a/vv/vvReadState.h b/vv/vvReadState.h index a34c464..b10a2cb 100644 --- a/vv/vvReadState.h +++ b/vv/vvReadState.h @@ -29,8 +29,13 @@ protected: std::string ReadVector(int index); std::string ReadLink(); +#if __cplusplus > 199711L + std::shared_ptr m_XmlReader; + std::shared_ptr m_File; +#else std::auto_ptr m_XmlReader; std::auto_ptr m_File; +#endif vvMainWindow* m_Window; int m_TreeItemCount; int m_NumImages; diff --git a/vv/vvSaveState.h b/vv/vvSaveState.h index 4f96c06..8085e25 100644 --- a/vv/vvSaveState.h +++ b/vv/vvSaveState.h @@ -30,8 +30,13 @@ protected: void SaveVector(const QTreeWidgetItem* item); void SaveLink(const vvSlicerManager* slicerManager); +#if __cplusplus > 199711L + std::shared_ptr m_XmlWriter; + std::shared_ptr m_File; +#else std::auto_ptr m_XmlWriter; std::auto_ptr m_File; +#endif vvMainWindow* m_Window; }; diff --git a/vv/vvToolBaseBase.cxx b/vv/vvToolBaseBase.cxx index 544bc5e..c71a216 100644 --- a/vv/vvToolBaseBase.cxx +++ b/vv/vvToolBaseBase.cxx @@ -20,7 +20,11 @@ #include "vvToolBaseBase.h" //------------------------------------------------------------------------------ -void vvToolBaseBase::SaveState(std::auto_ptr & m_XmlWriter) +#if __cplusplus > 199711L +void vvToolBaseBase::SaveState(std::shared_ptr & m_XmlWriter) +#else +void vvToolBaseBase::SaveState(std::auto_ptr & m_XmlWriter) +#endif { std::cerr << "SaveState not implemented for this tool." << std::endl; } diff --git a/vv/vvToolBaseBase.h b/vv/vvToolBaseBase.h index fa93d14..9c76bb1 100644 --- a/vv/vvToolBaseBase.h +++ b/vv/vvToolBaseBase.h @@ -32,8 +32,11 @@ public: std::vector & v = mCreator->GetListOfTool(); v.erase(std::find(v.begin(), v.end(), this)); }; - +#if __cplusplus > 199711L + virtual void SaveState(std::shared_ptr & m_XmlWriter); +#else virtual void SaveState(std::auto_ptr & m_XmlWriter); +#endif virtual void InitializeNewTool(bool ReadStateFlag); void SetCreator(vvToolCreatorBase * m) { mCreator = m; } void SetXmlReader(QXmlStreamReader * r, int index) { m_XmlReader = r; mImageIndex = index;} diff --git a/vv/vvToolCreatorBase.h b/vv/vvToolCreatorBase.h index b2c942f..5ade4a4 100644 --- a/vv/vvToolCreatorBase.h +++ b/vv/vvToolCreatorBase.h @@ -35,7 +35,7 @@ class vvToolCreatorBase: public QObject { public: vvToolCreatorBase(QString name); - virtual ~vvToolCreatorBase() {;} + virtual ~vvToolCreatorBase() {} virtual void InsertToolInMenu(vvMainWindowBase * m); virtual void InsertToolInContextMenu(); template void CreateTool(); @@ -55,7 +55,11 @@ class vvToolCreatorBase: public QObject { bool mUseContextMenu; QMenu * mToolMenu; std::vector mListOfActions; +#if __cplusplus > 199711L + std::shared_ptr m_XmlReader; +#else std::auto_ptr m_XmlReader; +#endif bool mReadStateFlag; int mImageIndex; diff --git a/vv/vvToolROIManager.cxx b/vv/vvToolROIManager.cxx index 791db06..4c2832e 100644 --- a/vv/vvToolROIManager.cxx +++ b/vv/vvToolROIManager.cxx @@ -865,7 +865,11 @@ void vvToolROIManager::ReloadCurrentROI() //------------------------------------------------------------------------------ +#if __cplusplus > 199711L +void vvToolROIManager::SaveState(std::shared_ptr & m_XmlWriter) +#else void vvToolROIManager::SaveState(std::auto_ptr & m_XmlWriter) +#endif { // Get index of the image int n = mMainWindow->GetSlicerManagers().size(); diff --git a/vv/vvToolROIManager.h b/vv/vvToolROIManager.h index fdf68a6..db630c6 100644 --- a/vv/vvToolROIManager.h +++ b/vv/vvToolROIManager.h @@ -51,7 +51,11 @@ class vvToolROIManager: void AddImage(vvImage * binaryImage, std::string name, std::string filename, double BG, bool m_modeBG=true); void UpdateAllContours(); void UpdateAllROIStatus(); +#if __cplusplus > 199711L + virtual void SaveState(std::shared_ptr & m_XmlWriter); +#else virtual void SaveState(std::auto_ptr & m_XmlWriter); +#endif virtual void InitializeNewTool(bool ReadStateFlag); public slots: