OpenToonz - An open-source full-featured 2D animation creation software
C
replace smart pointers
Shinya Kitaokae5734ac43769
diff --git a/toonz/sources/common/trop/tdistancetransform.cpp b/toonz/sources/common/trop/tdistancetransform.cppindex 0e16f62ce..f6175e59f 100644--- a/toonz/sources/common/trop/tdistancetransform.cpp+++ b/toonz/sources/common/trop/tdistancetransform.cpp@@ -1,13 +1,10 @@-+#include <memory>#include "tropcm.h"// TnzCore includes#include "traster.h"-// boost includes-#include <boost/scoped_array.hpp>-// STD includes#include <limits>@@ -113,7 +110,7 @@ void expand(int lineLength, int linesCount,// Allocate a buffer equivalent to a dt line. It will store the original// dt values. Final dt values will be written directly on the dt raster.// This is necessary since read and write intervals overlap.- boost::scoped_array<unsigned int> dtOriginalLine(new unsigned int[lineLength]);+ std::unique_ptr<unsigned[]> dtOriginalLine(new unsigned[lineLength]);unsigned int *odtLineStart = dtOriginalLine.get(),*odtLineEnd = odtLineStart + lineLength;diff --git a/toonz/sources/include/ext/ttexturesstorage.h b/toonz/sources/include/ext/ttexturesstorage.hindex 94beb45b5..b97a37364 100644--- a/toonz/sources/include/ext/ttexturesstorage.h+++ b/toonz/sources/include/ext/ttexturesstorage.h@@ -1,17 +1,14 @@--#ifndef DRAWABLEMESHIMAGE_H#define DRAWABLEMESHIMAGE_H+#include <memory>+// TnzExt includes#include "meshtexturizer.h"// TnzCore includes#include "tgldisplaylistsmanager.h"-// Boost includes-#include <boost/shared_ptr.hpp>-#undef DVAPI#undef DVVAR#ifdef TNZEXT_EXPORTS@@ -48,7 +45,7 @@ private:DrawableTextureData &operator=(const DrawableTextureData &);};-typedef boost::shared_ptr<DrawableTextureData> DrawableTextureDataP;+typedef std::shared_ptr<DrawableTextureData> DrawableTextureDataP;//***************************************************************************************// TexturesStorage declarationdiff --git a/toonz/sources/include/tools/strokeselection.h b/toonz/sources/include/tools/strokeselection.hindex a6391cadd..fb5265aec 100644--- a/toonz/sources/include/tools/strokeselection.h+++ b/toonz/sources/include/tools/strokeselection.h@@ -1,8 +1,8 @@--#ifndef STROKE_SELECTION_H#define STROKE_SELECTION_H+#include <memory>+// TnzQt includes#include "toonzqt/selection.h"@@ -10,9 +10,6 @@#include "tcommon.h"#include "tvectorimage.h"-// boost includes-#include <boost/scoped_ptr.hpp>-// STD includes#include <set>@@ -88,7 +85,7 @@ private:TVectorImageP m_vi; //!< Selected vector image.IndexesContainer m_indexes; //!< Selected stroke indexes in m_vi.- boost::scoped_ptr<TGroupCommand> m_groupCommand; //!< Groups commands wrapper.+ std::unique_ptr<TGroupCommand> m_groupCommand; //!< Groups commands wrapper.TSceneHandle *m_sceneHandle; //!< Global scene handle. \deprecated Use TApplication instead./*!Set this boolean to true before call tool->notifyImageChanged() when you want to reset strokes bbox.diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.hindex 70bcb2724..045d1dfba 100644--- a/toonz/sources/include/toonz/preferences.h+++ b/toonz/sources/include/toonz/preferences.h@@ -1,8 +1,8 @@--#ifndef PREFERENCES_H#define PREFERENCES_H+#include <memory>+// TnzCore includes#include "tcommon.h"#include "tgeometry.h"@@ -17,9 +17,6 @@#include <QMap>#include <QRegExp>-// boost includes-#include <boost/scoped_ptr.hpp>-#undef DVAPI#undef DVVAR#ifdef TOONZLIB_EXPORTS@@ -431,7 +428,7 @@ public:void startAutoSave();private:- boost::scoped_ptr<QSettings> m_settings;+ std::unique_ptr<QSettings> m_settings;QMap<int, QString> m_languageMaps,m_styleSheetMaps;diff --git a/toonz/sources/include/toonz/txshsimplelevel.h b/toonz/sources/include/toonz/txshsimplelevel.hindex 277417246..93eadb145 100644--- a/toonz/sources/include/toonz/txshsimplelevel.h+++ b/toonz/sources/include/toonz/txshsimplelevel.h@@ -1,8 +1,8 @@--#ifndef TXSHSIMPLELEVEL_INCLUDED#define TXSHSIMPLELEVEL_INCLUDED+#include <memory>+// TnzLib includes#include "toonz/txshlevel.h"#include "toonz/txshleveltypes.h"@@ -17,7 +17,6 @@#include <QStringList>// boost includes-#include <boost/scoped_ptr.hpp>#include <boost/container/flat_set.hpp>#include <boost/container/flat_map.hpp>@@ -322,10 +321,8 @@ private:typedef boost::container::flat_set<TFrameId> FramesSet;private:- boost::- scoped_ptr<LevelProperties> m_properties;- boost::- scoped_ptr<TContentHistory> m_contentHistory;+ std::unique_ptr<LevelProperties> m_properties;+ std::unique_ptr<TContentHistory> m_contentHistory;TPalette *m_palette;diff --git a/toonz/sources/tnzext/meshtexturizer.cpp b/toonz/sources/tnzext/meshtexturizer.cppindex 576c202a6..2489872f7 100644--- a/toonz/sources/tnzext/meshtexturizer.cpp+++ b/toonz/sources/tnzext/meshtexturizer.cpp@@ -1,4 +1,4 @@-+#include <memory>#include "ext/meshtexturizer.h"@@ -15,10 +15,6 @@#include "tcg/tcg_list.h"#include "tcg/tcg_misc.h"-// Boost includes-#include <boost/shared_ptr.hpp>-#include <boost/make_shared.hpp>-#define COPIED_BORDER 1 // Amount of tile border from the original image#define TRANSP_BORDER 1 // Amount of transparent tile border#define NONPREM_BORDER 1 // Amount of nonpremultiplied copied transparent border@@ -39,7 +35,7 @@ class MeshTexturizer::Imppublic:QReadWriteLock m_lock; //!< Lock for synchronized access- tcg::list<boost::shared_ptr<TextureData>> m_textureDatas; //!< Pool of texture datas+ tcg::list<std::shared_ptr<TextureData>> m_textureDatas; //!< Pool of texture dataspublic:Imp() : m_lock(QReadWriteLock::Recursive) {}@@ -232,7 +228,7 @@ int MeshTexturizer::bindTexture(const TRaster32P &ras, const TRectD &geom,glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);// Initialize a new texture data- int dataIdx = m_imp->m_textureDatas.push_back(boost::make_shared<TextureData>(geom));+ int dataIdx = m_imp->m_textureDatas.push_back(std::make_shared<TextureData>(geom));// Textures must have 2-power sizes. So, let's start with the smallest 2 power// >= ras's sizes.diff --git a/toonz/sources/tnzext/plasticdeformerstorage.cpp b/toonz/sources/tnzext/plasticdeformerstorage.cppindex 8960aa3bd..b0262edd1 100644--- a/toonz/sources/tnzext/plasticdeformerstorage.cpp+++ b/toonz/sources/tnzext/plasticdeformerstorage.cpp@@ -1,4 +1,4 @@-+#include <memory>// TnzExt includes#include "ext/plasticskeleton.h"@@ -10,9 +10,6 @@#include <algorithm>// Boost includes-#include <boost/shared_ptr.hpp>-#include <boost/make_shared.hpp>-#include <boost/multi_index_container.hpp>#include <boost/multi_index/ordered_index.hpp>#include <boost/multi_index/member.hpp>@@ -42,7 +39,7 @@ struct Key {const TMeshImage *m_mi;DeformedSkeleton m_ds;- boost::shared_ptr<DataGroup> m_dataGroup;+ std::shared_ptr<DataGroup> m_dataGroup;public:Key(const TMeshImage *mi, const SkD *sd, int skelId)@@ -472,7 +469,7 @@ PlasticDeformerDataGroup *PlasticDeformerStorage::deformerData(DeformersByKey::iterator dt = m_imp->m_deformers.find(key);if (dt == m_imp->m_deformers.end()) {// No deformer was found. Allocate it.- key.m_dataGroup = boost::make_shared<PlasticDeformerDataGroup>();+ key.m_dataGroup = std::make_shared<PlasticDeformerDataGroup>();initializeDeformersData(key.m_dataGroup.get(), meshImage);dt = m_imp->m_deformers.insert(key).first;diff --git a/toonz/sources/tnzext/ttexturesstorage.cpp b/toonz/sources/tnzext/ttexturesstorage.cppindex 48e047e65..7d369ae64 100644--- a/toonz/sources/tnzext/ttexturesstorage.cpp+++ b/toonz/sources/tnzext/ttexturesstorage.cpp@@ -1,4 +1,4 @@-+#include <memory>// TnzCore includes#include "tgl.h"@@ -9,9 +9,6 @@// tcg includes#include "tcg/tcg_list.h"-// Boost includes-#include <boost/make_shared.hpp>-// Qt includes#include <QString>#include <QCache>@@ -150,7 +147,7 @@ DrawableTextureDataP TTexturesStorage::loadTexture(MeshTexturizer &texturizer = it->second->m_texturizer;- DrawableTextureDataP dataPtr = boost::make_shared<DrawableTextureData>();+ DrawableTextureDataP dataPtr = std::make_shared<DrawableTextureData>();DrawableTextureData *data = dataPtr.get();data->m_dlSpaceId = dlSpaceId;diff --git a/toonz/sources/toonz/cleanuppopup.h b/toonz/sources/toonz/cleanuppopup.hindex cef7ffd75..349cd3ab0 100644--- a/toonz/sources/toonz/cleanuppopup.h+++ b/toonz/sources/toonz/cleanuppopup.h@@ -1,8 +1,8 @@--#ifndef CLEANUPPOPUP_H#define CLEANUPPOPUP_H+#include <memory>+// TnzQt includes#include "toonzqt/validatedchoicedialog.h"@@ -11,7 +11,6 @@#include "timage.h"// boost includes-#include <boost/scoped_ptr.hpp>#include <boost/container/vector.hpp>#include <QMap>@@ -73,7 +72,7 @@ private:QPushButton *m_cleanupButton;QPushButton *m_skipButton;- boost::scoped_ptr<LevelUpdater>+ std::unique_ptr<LevelUpdater>m_updater; //!< The cleanup level updater.bc::vector<CleanupLevel> m_cleanupLevels; //!< List of levels to be cleanupped.@@ -84,10 +83,10 @@ private:std::vector<TFrameId> m_cleanuppedLevelFrames; //!< Current level's list of cleanupped frames. Used//! to selectively build the level's unpainted backup.- boost::scoped_ptr<CleanupParameters>+ std::unique_ptr<CleanupParameters>m_params; //!< Cleanup params used to cleanup.- boost::scoped_ptr<OverwriteDialog>+ std::unique_ptr<OverwriteDialog>m_overwriteDialog; //!< Dialog about level overwriting options./* Palette上書きの判断をするために、保存先Levelが既に存在するかどうかのフラグdiff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cppindex 48396dc25..8ab77b4a1 100644--- a/toonz/sources/toonz/iocommand.cpp+++ b/toonz/sources/toonz/iocommand.cpp@@ -1,4 +1,4 @@-+#include <memory>#include "iocommand.h"@@ -2177,7 +2177,7 @@ int loadPSDResource(IoCmd::LoadResourceArguments &args, bool updateRecentFile, Ptypedef IoCmd::LoadResourceArguments::ScopedBlock LoadScopedBlock;struct LoadScopedBlock::Data {- boost::scoped_ptr<DVGui::ProgressDialog>+ std::unique_ptr<DVGui::ProgressDialog>m_progressDialog; //!< Progress dialog displayed on multiple paths.int m_loadedCount; //!< Number of loaded levels.bool m_hasSoundLevel; //!< Whether a sound level was loaded.diff --git a/toonz/sources/toonz/iocommand.h b/toonz/sources/toonz/iocommand.hindex c8b4591ea..825b8ad91 100644--- a/toonz/sources/toonz/iocommand.h+++ b/toonz/sources/toonz/iocommand.h@@ -1,8 +1,8 @@--#ifndef IOCOMMAND_H#define IOCOMMAND_H+#include <memory>+// TnzLib includes#include "toonz/preferences.h"@@ -14,7 +14,6 @@#include <QDialog>// boost includes-#include <boost/scoped_ptr.hpp>#include <boost/optional.hpp>// STD includes@@ -73,7 +72,7 @@ struct LoadResourceArguments {Data &data() const { return *m_data; } //!< Internal data used by the loading procedure.private:- boost::scoped_ptr<Data> m_data;+ std::unique_ptr<Data> m_data;};struct ResourceData //! Data about a single resource to be loaded.diff --git a/toonz/sources/toonz/vectorizerpopup.h b/toonz/sources/toonz/vectorizerpopup.hindex 7de3e4a4a..75cf3c11c 100644--- a/toonz/sources/toonz/vectorizerpopup.h+++ b/toonz/sources/toonz/vectorizerpopup.h@@ -1,8 +1,8 @@--#ifndef VECTORIZERPOPUP_H#define VECTORIZERPOPUP_H+#include <memory>+// TnzCore includes#include "tvectorimage.h"@@ -13,9 +13,6 @@// TnzQt includes#include "toonzqt/dvdialog.h"-// boost includes-#include <boost/scoped_ptr.hpp>-// Qt includes#include <QWidget>#include <QThread>@@ -301,7 +298,7 @@ private:TXshSimpleLevelP m_vLevel; //!< Output vectorized levelstd::vector<TFrameId> m_fids; //!< Frame ids of the input \b m_level- boost::scoped_ptr<OverwriteDialog>+ std::unique_ptr<OverwriteDialog>m_dialog; //!< Dialog to be shown for overwrite resolution.bool m_isCanceled, //!< User cancels set this flag to true