diff --git a/toonz/sources/common/tcore/tthread_nt.cpp b/toonz/sources/common/tcore/tthread_nt.cpp index 23d895f..18919f5 100644 --- a/toonz/sources/common/tcore/tthread_nt.cpp +++ b/toonz/sources/common/tcore/tthread_nt.cpp @@ -4,8 +4,6 @@ #define _WIN32_WINNT 0x0400 #include -using std::list; - class TThreadGroupImp; //--------------------------------------------------------------------------- // TMutex & TMutexImp @@ -24,7 +22,7 @@ public: //--------------------------------------------------------------------------- class TThreadGroupImp { - list threads; + std::list threads; public: TThreadGroupImp(); @@ -274,7 +272,7 @@ void TThreadGroupImp::wait() { if (count == 0) return; HANDLE *hThreads = new HANDLE[count]; int id = 0; - for (list::iterator it = threads.begin(); it != threads.end(); + for (std::list::iterator it = threads.begin(); it != threads.end(); it++, id++) { TThread *t = *it; if (t->m_imp->threadId == 0) t->start(); diff --git a/toonz/sources/common/tcore/tundo.cpp b/toonz/sources/common/tcore/tundo.cpp index 9547a5d..4eb219a 100644 --- a/toonz/sources/common/tcore/tundo.cpp +++ b/toonz/sources/common/tcore/tundo.cpp @@ -5,8 +5,6 @@ //----------------------------------------------------------------------------- -using std::for_each; - namespace { void deleteUndo(const TUndo *undo) { delete undo; } @@ -26,7 +24,7 @@ public: assert(m_undoing == false); assert(m_deleted == false); m_deleted = true; - for_each(m_undos.begin(), m_undos.end(), deleteUndo); + std::for_each(m_undos.begin(), m_undos.end(), deleteUndo); m_undos.clear(); } @@ -49,7 +47,7 @@ public: assert(!m_undoing); m_undoing = true; // VERSIONE CORRETTA - for_each(m_undos.rbegin(), m_undos.rend(), callUndo); + std::for_each(m_undos.rbegin(), m_undos.rend(), callUndo); // VERSIONE SBAGLIATA // for_each(m_undos.begin(), m_undos.end(), callUndo); m_undoing = false; @@ -57,7 +55,7 @@ public: void redo() const override { assert(!m_deleted); // VERSIONE CORRETTA - for_each(m_undos.begin(), m_undos.end(), callRedo); + std::for_each(m_undos.begin(), m_undos.end(), callRedo); // VERSIONE SBAGLIATA // for_each(m_undos.rbegin(), m_undos.rend(), callRedo); } @@ -181,7 +179,7 @@ void TUndoManager::TUndoManagerImp::add(TUndo *undo) { void TUndoManager::TUndoManagerImp::doAdd(TUndo *undo) { if (m_current != m_undoList.end()) { - for_each(m_current, m_undoList.end(), deleteUndo); + std::for_each(m_current, m_undoList.end(), deleteUndo); m_undoList.erase(m_current, m_undoList.end()); } @@ -208,7 +206,7 @@ void TUndoManager::TUndoManagerImp::doAdd(TUndo *undo) { void TUndoManager::beginBlock() { if (m_imp->m_current != m_imp->m_undoList.end()) { - for_each(m_imp->m_current, m_imp->m_undoList.end(), deleteUndo); + std::for_each(m_imp->m_current, m_imp->m_undoList.end(), deleteUndo); m_imp->m_undoList.erase(m_imp->m_current, m_imp->m_undoList.end()); } @@ -315,7 +313,7 @@ void TUndoManager::reset() { assert(m_imp->m_blockStack.empty()); m_imp->m_blockStack.clear(); UndoList &lst = m_imp->m_undoList; - for_each(lst.begin(), lst.end(), deleteUndo); + std::for_each(lst.begin(), lst.end(), deleteUndo); lst.clear(); m_imp->m_current = m_imp->m_undoList.end(); Q_EMIT historyChanged(); @@ -380,7 +378,7 @@ void TUndoManager::popUndo(int n, bool forward) { i++; } } - for_each(start, end, deleteUndo); + std::for_each(start, end, deleteUndo); m_imp->m_undoList.erase(start, end); m_imp->m_current = m_imp->m_undoList.end(); } else diff --git a/toonz/sources/common/tsystem/tlogger.cpp b/toonz/sources/common/tsystem/tlogger.cpp index a8114fa..ad56cbe 100644 --- a/toonz/sources/common/tsystem/tlogger.cpp +++ b/toonz/sources/common/tsystem/tlogger.cpp @@ -10,8 +10,6 @@ #include #include -using std::endl; - class TLogger::Imp { public: std::vector m_messages; diff --git a/toonz/sources/include/cellposition.h b/toonz/sources/include/cellposition.h index 3a39eae..1aa15b5 100644 --- a/toonz/sources/include/cellposition.h +++ b/toonz/sources/include/cellposition.h @@ -5,9 +5,6 @@ #include -using std::min; -using std::max; - // Identifies cells by frame and layer rather than row and column class CellPosition { int _frame; // a frame number. corresponds to row in vertical xsheet @@ -46,8 +43,10 @@ class CellRange { public: CellRange() {} CellRange(const CellPosition &from, const CellPosition &to) - : _from(min(from.frame(), to.frame()), min(from.layer(), to.layer())) - , _to(max(from.frame(), to.frame()), max(from.layer(), to.layer())) {} + : _from(std::min(from.frame(), to.frame()), + std::min(from.layer(), to.layer())) + , _to(std::max(from.frame(), to.frame()), + std::max(from.layer(), to.layer())) {} const CellPosition &from() const { return _from; } const CellPosition &to() const { return _to; } diff --git a/toonz/sources/include/orientation.h b/toonz/sources/include/orientation.h index 7199501..86ac2aa 100644 --- a/toonz/sources/include/orientation.h +++ b/toonz/sources/include/orientation.h @@ -23,9 +23,6 @@ #include #include -using std::map; -using std::vector; - // Defines timeline direction: top to bottom; left to right. // old (vertical timeline) = new (universal) = old (kept) // x = layer axis = column @@ -38,7 +35,8 @@ class DVAPI NumberRange { NumberRange() : _from(0), _to(0) {} public: - NumberRange(int from, int to) : _from(min(from, to)), _to(max(from, to)) {} + NumberRange(int from, int to) + : _from(std::min(from, to)), _to(std::max(from, to)) {} int from() const { return _from; } int to() const { return _to; } @@ -205,13 +203,13 @@ enum class PredefinedFlag { // Knows everything about geometry of a particular orientation. class DVAPI Orientation { protected: - map _rects; - map _lines; - map _dimensions; - map _paths; - map _points; - map _ranges; - map _flags; + std::map _rects; + std::map _lines; + std::map _dimensions; + std::map _paths; + std::map _points; + std::map _ranges; + std::map _flags; public: virtual CellPosition xyToPosition(const QPoint &xy, @@ -283,7 +281,7 @@ protected: // Enumerates all orientations available in the system as global const objects. class DVAPI Orientations { const Orientation *_topToBottom, *_leftToRight; - vector _all; + std::vector _all; Orientations(); @@ -297,7 +295,7 @@ public: static const Orientation *topToBottom(); static const Orientation *leftToRight(); - static const vector &all(); + static const std::vector &all(); static const Orientation *byName(const QString &name); }; diff --git a/toonz/sources/include/tfarmcontroller.h b/toonz/sources/include/tfarmcontroller.h index 4c9e4cb..2e72285 100644 --- a/toonz/sources/include/tfarmcontroller.h +++ b/toonz/sources/include/tfarmcontroller.h @@ -5,8 +5,6 @@ #include -using std::vector; - #include "tfarmtask.h" //#include "texception.h" #include "tconvert.h" @@ -86,10 +84,11 @@ public: virtual void activateTask(const QString &id) = 0; virtual void restartTask(const QString &id) = 0; - virtual void getTasks(vector &tasks) = 0; - virtual void getTasks(const QString &parentId, vector &tasks) = 0; + virtual void getTasks(std::vector &tasks) = 0; + virtual void getTasks(const QString &parentId, + std::vector &tasks) = 0; virtual void getTasks(const QString &parentId, - vector &tasks) = 0; + std::vector &tasks) = 0; virtual void queryTaskInfo(const QString &id, TFarmTask &task) = 0; @@ -115,7 +114,7 @@ public: virtual void taskCompleted(const QString &taskId, int exitCode) = 0; // fills the servers vector with the identities of the servers - virtual void getServers(vector &servers) = 0; + virtual void getServers(std::vector &servers) = 0; // returns the state of the server whose id has been specified virtual ServerState queryServerState2(const QString &id) = 0; diff --git a/toonz/sources/include/tnotanimatableparam.h b/toonz/sources/include/tnotanimatableparam.h index d61f07b..d904754 100644 --- a/toonz/sources/include/tnotanimatableparam.h +++ b/toonz/sources/include/tnotanimatableparam.h @@ -95,15 +95,14 @@ typedef TNotAnimatableParamObserver TFilePathParamObserver; //----------------------------------------------------------------------------- // TNotAnimatableParam base class //----------------------------------------------------------------------------- -using std::set; template class DVAPI TNotAnimatableParam : public TParam { T m_defaultValue, m_value; protected: - set *> m_observers; - set m_paramObservers; + std::set *> m_observers; + std::set m_paramObservers; public: TNotAnimatableParam(T def = T()) diff --git a/toonz/sources/stopmotion/stopmotion.cpp b/toonz/sources/stopmotion/stopmotion.cpp index c0ebe69..b400ece 100644 --- a/toonz/sources/stopmotion/stopmotion.cpp +++ b/toonz/sources/stopmotion/stopmotion.cpp @@ -442,7 +442,7 @@ void StopMotion::lowerOpacity() { opacity *= 10; opacity -= 10; m_opacity = double(opacity) / 100.0 * 255.0; - m_opacity = max(0, m_opacity); + m_opacity = std::max(0, m_opacity); StopMotionOpacity = m_opacity; emit(opacityChanged(m_opacity)); } @@ -454,7 +454,7 @@ void StopMotion::raiseOpacity() { opacity *= 10; opacity += 10; m_opacity = double(opacity) / 100.0 * 255.0; - m_opacity = min(255, m_opacity); + m_opacity = std::min(255, m_opacity); StopMotionOpacity = m_opacity; emit(opacityChanged(m_opacity)); } diff --git a/toonz/sources/tnztools/strokeselection.cpp b/toonz/sources/tnztools/strokeselection.cpp index dabd937..bebf83d 100644 --- a/toonz/sources/tnztools/strokeselection.cpp +++ b/toonz/sources/tnztools/strokeselection.cpp @@ -454,10 +454,9 @@ void StrokeSelection::removeEndpoints() { std::vector> undoData; m_vi->findRegions(); - set::iterator it = m_indexes.begin(); - for (; it != m_indexes.end(); ++it) { - TStroke *s = m_vi->removeEndpoints(*it); - if (s) undoData.push_back(std::pair(*it, s)); + for (auto const &e : m_indexes) { + TStroke *s = m_vi->removeEndpoints(e); + if (s) undoData.push_back(std::pair(e, s)); } TTool *tool = TTool::getApplication()->getCurrentTool()->getTool(); TXshSimpleLevel *level = diff --git a/toonz/sources/tnztools/vectorerasertool.cpp b/toonz/sources/tnztools/vectorerasertool.cpp index 766a7a0..0fc6ae4 100644 --- a/toonz/sources/tnztools/vectorerasertool.cpp +++ b/toonz/sources/tnztools/vectorerasertool.cpp @@ -1321,21 +1321,21 @@ void EraserTool::eraseSegments(const TVectorImageP vi, TStroke *eraseStroke) { } if (intersection.first < w) { - lowerW = max(lowerW, intersection.first); + lowerW = std::max(lowerW, intersection.first); } else { - higherW = min(higherW, intersection.first); + higherW = std::min(higherW, intersection.first); } if (intersection.second < w) { - lowerW = max(lowerW, intersection.second); + lowerW = std::max(lowerW, intersection.second); } else { - higherW = min(higherW, intersection.second); + higherW = std::min(higherW, intersection.second); } - lowerW1 = max(lowerW1, intersection.first); - higherW0 = min(higherW0, intersection.first); - lowerW1 = max(lowerW1, intersection.second); - higherW0 = min(higherW0, intersection.second); + lowerW1 = std::max(lowerW1, intersection.first); + higherW0 = std::min(higherW0, intersection.first); + lowerW1 = std::max(lowerW1, intersection.second); + higherW0 = std::min(higherW0, intersection.second); } // then check intersection with other strokes @@ -1348,12 +1348,12 @@ void EraserTool::eraseSegments(const TVectorImageP vi, TStroke *eraseStroke) { intersect(stroke, intersectedStroke, intersections, false); for (auto &intersection : intersections) { if (intersection.first < w) { - lowerW = max(lowerW, intersection.first); + lowerW = std::max(lowerW, intersection.first); } else { - higherW = min(higherW, intersection.first); + higherW = std::min(higherW, intersection.first); } - lowerW1 = max(lowerW1, intersection.first); - higherW0 = min(higherW0, intersection.first); + lowerW1 = std::max(lowerW1, intersection.first); + higherW0 = std::min(higherW0, intersection.first); } } diff --git a/toonz/sources/toonz/batches.cpp b/toonz/sources/toonz/batches.cpp index ea40804..1fdd8e0 100644 --- a/toonz/sources/toonz/batches.cpp +++ b/toonz/sources/toonz/batches.cpp @@ -135,7 +135,7 @@ bool SaveTaskListPopup::execute() { //------------------------------------------------------------------------------ QMutex TasksMutex; -map RunningTasks; +std::map RunningTasks; class TaskRunner final : public TThread::Runnable { public: @@ -288,7 +288,7 @@ void BatchesController::setTasksTree(TaskTreeModel *tree) { //------------------------------------------------------------------------------ -inline bool isMovieType(string type) { +inline bool isMovieType(std::string type) { return (type == "mov" || type == "avi" || type == "3gp"); } @@ -895,7 +895,7 @@ void BatchesController::doSave(const TFilePath &_fp) { TOStream os(fp); - std::map attr; + std::map attr; attr["version"] = "1.0"; os.openChild("tnzbatches", attr); @@ -1039,7 +1039,7 @@ public: void activateTask(const QString &id) override; void restartTask(const QString &id) override; - void getTasks(vector &tasks) override; + void getTasks(std::vector &tasks) override; void getTasks(const QString &parentId, std::vector &tasks) override; void getTasks(const QString &parentId, std::vector &tasks) override; @@ -1068,7 +1068,9 @@ public: void taskCompleted(const QString &taskId, int exitCode) override; - void getServers(vector &servers) override { assert(false); } + void getServers(std::vector &servers) override { + assert(false); + } ServerState queryServerState2(const QString &id) override { assert(false); @@ -1126,7 +1128,7 @@ void MyLocalController::activateTask(const QString &id) { assert(false); } void MyLocalController::restartTask(const QString &id) { assert(false); } -void MyLocalController::getTasks(vector &tasks) { assert(false); } +void MyLocalController::getTasks(std::vector &tasks) { assert(false); } void MyLocalController::getTasks(const QString &parentId, std::vector &tasks) { diff --git a/toonz/sources/toonz/batches.h b/toonz/sources/toonz/batches.h index e8513a8..05fb72f 100644 --- a/toonz/sources/toonz/batches.h +++ b/toonz/sources/toonz/batches.h @@ -12,9 +12,6 @@ #include "tfilepath.h" #include "tthread.h" #include "filebrowserpopup.h" -using std::map; -using std::set; -using std::vector; class TFarmController; @@ -96,7 +93,7 @@ private: bool m_dirtyFlag; TFilePath m_filepath; std::map m_tasks; - set m_observers; + std::set m_observers; int m_localControllerPortNumber; TFarmController *m_controller; std::map m_farmIdsTable; diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp index 7ce9319..27a6229 100644 --- a/toonz/sources/toonz/cellselection.cpp +++ b/toonz/sources/toonz/cellselection.cpp @@ -831,11 +831,11 @@ public: //============================================================================= void pasteDrawingsInCellWithoutUndo(TXsheet *xsh, TXshSimpleLevel *level, - const set &frameIds, int r0, + const std::set &frameIds, int r0, int c0) { int frameToInsert = frameIds.size(); xsh->insertCells(r0, c0, frameToInsert); - set::const_iterator it; + std::set::const_iterator it; int r = r0; for (it = frameIds.begin(); it != frameIds.end(); it++, r++) { TXshCell cell(level, *it); @@ -850,12 +850,12 @@ void pasteDrawingsInCellWithoutUndo(TXsheet *xsh, TXshSimpleLevel *level, class PasteDrawingsInCellUndo final : public TUndo { TXsheet *m_xsheet; int m_r0, m_c0; - set m_frameIds; + std::set m_frameIds; TXshSimpleLevelP m_level; public: - PasteDrawingsInCellUndo(TXshSimpleLevel *level, const set &frameIds, - int r0, int c0) + PasteDrawingsInCellUndo(TXshSimpleLevel *level, + const std::set &frameIds, int r0, int c0) : TUndo(), m_level(level), m_frameIds(frameIds), m_r0(r0), m_c0(c0) { m_xsheet = TApp::instance()->getCurrentXsheet()->getXsheet(); m_xsheet->addRef(); @@ -1808,7 +1808,7 @@ void TCellSelection::pasteCells() { if (isEmpty()) // Se la selezione delle celle e' vuota ritorno. return; - set frameIds; + std::set frameIds; drawingData->getFrames(frameIds); TXshSimpleLevel *level = drawingData->getLevel(); if (level && !frameIds.empty()) @@ -2886,12 +2886,10 @@ void TCellSelection::dPasteCells() { } else if (DYNAMIC_CAST(DrawingData, drawingData, mimeData)) { TXshSimpleLevel *level = drawingData->getLevel(); if (level) { - set frameIds; + std::set frameIds; drawingData->getFrames(frameIds); - int r = r0; - for (set::iterator it = frameIds.begin(); it != frameIds.end(); - ++it) - createNewDrawing(xsh, r++, c0, level->getType()); + for (int i = 0; i < frameIds.size(); ++i) + createNewDrawing(xsh, r0 + i, c0, level->getType()); } } else if (DYNAMIC_CAST(StrokesData, strokesData, mimeData)) { createNewDrawing(xsh, r0, c0, PLI_XSHLEVEL); diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp index 102e33e..8da1f7f 100644 --- a/toonz/sources/toonz/iocommand.cpp +++ b/toonz/sources/toonz/iocommand.cpp @@ -2314,7 +2314,7 @@ int IoCmd::loadResources(LoadResourceArguments &args, bool updateRecentFile, LoadResourceArguments::IMPORT); } - vector paths; + std::vector paths; int all = 0; // Loop for all the resources to load diff --git a/toonz/sources/toonz/subscenecommand.cpp b/toonz/sources/toonz/subscenecommand.cpp index fa6f009..65cae7b 100644 --- a/toonz/sources/toonz/subscenecommand.cpp +++ b/toonz/sources/toonz/subscenecommand.cpp @@ -254,11 +254,9 @@ public: //----------------------------------------------------------------------------- void getFxConnections(QMap &fxConnetcions, - const set &fxs, TXsheet *xsh) { + const std::set &fxs, TXsheet *xsh) { TFxSet *terminalFxs = xsh->getFxDag()->getTerminalFxs(); - set::const_iterator it; - for (it = fxs.begin(); it != fxs.end(); it++) { - TFx *fx = (*it); + for (auto const &fx : fxs) { FxConnections connections; connections.setIsTerminal(terminalFxs->containsFx(fx)); int i; @@ -621,7 +619,7 @@ void bringObjectOut(TStageObject *obj, TXsheet *xsh, //----------------------------------------------------------------------------- -set explodeStageObjects( +std::set explodeStageObjects( TXsheet *xsh, TXsheet *subXsh, int index, const TStageObjectId &parentId, const GroupData &objGroupData, const TPointD &subPos, const GroupData &fxGroupData, QList &pegObjects, @@ -698,7 +696,7 @@ set explodeStageObjects( FxDag *innerDag = subXsh->getFxDag(); FxDag *outerDag = xsh->getFxDag(); TStageObjectId tmpParentId = parentId; - set indexes; + std::set indexes; int i; for (i = 0; i < subXsh->getColumnCount(); i++) { TXshColumn *innerColumn = subXsh->getColumn(i); @@ -928,18 +926,19 @@ void explodeFxs(TXsheet *xsh, TXsheet *subXsh, const GroupData &fxGroupData, //----------------------------------------------------------------------------- -set explode(TXsheet *xsh, TXsheet *subXsh, int index, - const TStageObjectId &parentId, const GroupData &objGroupData, - const TPointD &stageSubPos, const GroupData &fxGroupData, - const TPointD &fxSubPos, QList &pegObjects, - QMap &splines, - const std::vector &outPorts, bool onlyColumn, - bool linkToXsheet) { +std::set explode(TXsheet *xsh, TXsheet *subXsh, int index, + const TStageObjectId &parentId, + const GroupData &objGroupData, const TPointD &stageSubPos, + const GroupData &fxGroupData, const TPointD &fxSubPos, + QList &pegObjects, + QMap &splines, + const std::vector &outPorts, bool onlyColumn, + bool linkToXsheet) { // innerFx->outerFxs QMap> fxs; - set indexes = explodeStageObjects(xsh, subXsh, index, parentId, - objGroupData, stageSubPos, fxGroupData, - pegObjects, fxs, splines, onlyColumn); + std::set indexes = explodeStageObjects( + xsh, subXsh, index, parentId, objGroupData, stageSubPos, fxGroupData, + pegObjects, fxs, splines, onlyColumn); explodeFxs(xsh, subXsh, fxGroupData, fxs, fxSubPos, outPorts, linkToXsheet); return indexes; } @@ -1041,10 +1040,8 @@ void openSubXsheet() { int sceneLength = currentXsheet->getFrameCount(); std::set columnIndices = columnSelection->getIndices(); - std::set::iterator it; /*- Try openChild on each cell for each Column -*/ - for (it = columnIndices.begin(); it != columnIndices.end(); ++it) { - int c = *it; + for (auto const &c : columnIndices) { // See if the current row indicator is on an exposed sub-xsheet frame // If so, use that. targetCell = currentXsheet->getCell(row, c); @@ -1623,7 +1620,7 @@ public: //----------------------------------------------------------------------------- class CollapseFxUndo final : public CollapseUndo { - set m_fxs; + std::set m_fxs; QMap m_fxConnections; public: @@ -1632,7 +1629,7 @@ public: const QMap> &columnOutputConnections, const QMap> children, const QMap &parents, - const set &fxs, + const std::set &fxs, const QMap fxConnections) : CollapseUndo(indices, c0, data, newData, columnOutputConnections, children, parents) @@ -1640,8 +1637,7 @@ public: , m_fxConnections(fxConnections) {} ~CollapseFxUndo() { - set::const_iterator it; - for (it = m_fxs.begin(); it != m_fxs.end(); it++) (*it)->release(); + for (auto const &e : m_fxs) e->release(); } void undo() const override { @@ -1650,14 +1646,13 @@ public: TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); TFxSet *internalFxs = xsh->getFxDag()->getInternalFxs(); TFxSet *terminalFxs = xsh->getFxDag()->getTerminalFxs(); - set::const_iterator it; - for (it = m_fxs.begin(); it != m_fxs.end(); it++) - if (!internalFxs->containsFx((*it))) { - TOutputFx *outFx = dynamic_cast(*it); + for (auto const &e : m_fxs) + if (!internalFxs->containsFx(e)) { + TOutputFx *outFx = dynamic_cast(e); if (outFx) xsh->getFxDag()->addOutputFx(outFx); else - internalFxs->addFx((*it)); + internalFxs->addFx(e); } QMap::const_iterator it2; for (it2 = m_fxConnections.begin(); it2 != m_fxConnections.end(); it2++) { @@ -1933,7 +1928,7 @@ public: for (i = 0; i < columnFx->getOutputConnectionCount(); i++) outPorts.push_back(columnFx->getOutputConnection(i)); xsh->removeColumn(m_index); - set indexes = m_newIndexs; + std::set indexes = m_newIndexs; for (i = m_pegObjects.size() - 1; i >= 0; i--) xsh->getStageObjectTree()->insertStageObject(m_pegObjects[i]); QMap::const_iterator it3; @@ -2081,7 +2076,7 @@ public: TApp *app = TApp::instance(); TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); - set indexesToRemove = m_newIndexs; + std::set indexesToRemove = m_newIndexs; app->getCurrentXsheet()->blockSignals(true); app->getCurrentObject()->blockSignals(true); ColumnCmd::deleteColumns(indexesToRemove, false, true); @@ -2090,7 +2085,7 @@ public: int i; for (i = m_pegObjects.size() - 1; i >= 0; i--) xsh->getStageObjectTree()->removeStageObject(m_pegObjects[i]->getId()); - set indexes; + std::set indexes; indexes.insert(m_index); int to = m_to; int index = m_index; @@ -2134,7 +2129,7 @@ public: TApp *app = TApp::instance(); TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); xsh->clearCells(m_from, m_index, m_to - m_from + 1); - set indexes = m_newIndexs; + std::set indexes = m_newIndexs; int i; for (i = m_pegObjects.size() - 1; i >= 0; i--) xsh->getStageObjectTree()->insertStageObject(m_pegObjects[i]); @@ -2157,9 +2152,8 @@ public: } // reinsert in groups if (!m_objGroupIds.empty()) { - set::iterator it; - for (it = indexes.begin(); it != indexes.end(); it++) { - TStageObject *obj = xsh->getStageObject(TStageObjectId::ColumnId(*it)); + for (auto const &e : indexes) { + TStageObject *obj = xsh->getStageObject(TStageObjectId::ColumnId(e)); TStageObjectId parentId = obj->getParent(); TStageObject *parentObj = xsh->getStageObject(parentId); int i; @@ -2444,7 +2438,7 @@ void SubsceneCmd::explode(int index) { GroupData fxGroupData(fxGroupIds, fxGroupNames, fxEditingGroup); /*- Explode前のOutputFxのリストを取得 (oldOutFxs) -*/ - set oldOutFxs; + std::set oldOutFxs; int i, outFxCount = xsh->getFxDag()->getOutputFxCount(); for (i = 0; i < outFxCount; i++) oldOutFxs.insert(xsh->getFxDag()->getOutputFx(i)); @@ -2499,7 +2493,7 @@ void SubsceneCmd::explode(int index) { parentId = TStageObjectId::ColumnId(parentId.getIndex() - 1); // Explode - set newIndexes = + std::set newIndexes = ::explode(xsh, childLevel->getXsheet(), index, parentId, objGroupData, stageSubPos, fxGroupData, fxSubPos, pegObjects, splines, outPorts, ret == 2, wasLinkedToXsheet); @@ -2535,7 +2529,7 @@ void SubsceneCmd::explode(int index) { xsh->clearCells(from, index, to - from + 1); // Explode - set newIndexes = ::explode( + std::set newIndexes = ::explode( xsh, childLevel->getXsheet(), index + 1, parentId, objGroupData, stageSubPos + TPointD(10, 10), fxGroupData, fxSubPos + TPointD(10, 10), pegObjects, splines, outPorts, ret == 2, true); diff --git a/toonz/sources/toonz/svncommitdialog.cpp b/toonz/sources/toonz/svncommitdialog.cpp index a9e17ea..9d7cb85 100644 --- a/toonz/sources/toonz/svncommitdialog.cpp +++ b/toonz/sources/toonz/svncommitdialog.cpp @@ -511,7 +511,7 @@ void SVNCommitDialog::onStatusRetrieved(const QString &xmlResponse) { if (m_treeWidget->isVisible()) height += (filesToPutCount * 25); - setMinimumSize(350, min(height, 350)); + setMinimumSize(350, std::min(height, 350)); m_waitingLabel->hide(); m_commentLabel->show(); @@ -538,7 +538,7 @@ void SVNCommitDialog::onStatusRetrieved(const QString &xmlResponse) { if (m_treeWidget->isVisible()) height += (m_items.size() * 25); - setMinimumSize(350, min(height, 350)); + setMinimumSize(350, std::min(height, 350)); m_waitingLabel->hide(); m_textLabel->hide(); diff --git a/toonz/sources/toonz/svndeletedialog.cpp b/toonz/sources/toonz/svndeletedialog.cpp index e3e0da7..06f04f0 100644 --- a/toonz/sources/toonz/svndeletedialog.cpp +++ b/toonz/sources/toonz/svndeletedialog.cpp @@ -175,7 +175,7 @@ void SVNDeleteDialog::showEvent(QShowEvent *e) { int height = 50; if (m_treeWidget->isVisible()) height += (m_files.size() * 50); - setMinimumSize(300, min(height, 350)); + setMinimumSize(300, std::min(height, 350)); } QDialog::showEvent(e); } @@ -270,7 +270,7 @@ void SVNDeleteDialog::onDeleteServerButtonClicked() { int height = 175; if (m_treeWidget->isVisible()) height += (m_files.size() * 50); - setMinimumSize(300, min(height, 350)); + setMinimumSize(300, std::min(height, 350)); m_textLabel->setText( tr("You are deleting items also on repository. Are you sure ?")); diff --git a/toonz/sources/toonz/svnlockdialog.cpp b/toonz/sources/toonz/svnlockdialog.cpp index 819030b..3c4f110 100644 --- a/toonz/sources/toonz/svnlockdialog.cpp +++ b/toonz/sources/toonz/svnlockdialog.cpp @@ -189,7 +189,7 @@ void SVNLockDialog::onStatusRetrieved(const QString &xmlResponse) { if (m_treeWidget->isVisible()) height += (m_filesToEdit.size() * (m_lock ? 25 : 50)); - setMinimumSize(300, min(height, 350)); + setMinimumSize(300, std::min(height, 350)); m_waitingLabel->hide(); diff --git a/toonz/sources/toonz/svnrevertdialog.cpp b/toonz/sources/toonz/svnrevertdialog.cpp index 41feb4e..02a64e5 100644 --- a/toonz/sources/toonz/svnrevertdialog.cpp +++ b/toonz/sources/toonz/svnrevertdialog.cpp @@ -143,7 +143,7 @@ void SVNRevertDialog::onStatusRetrieved(const QString &xmlResponse) { } else { if (m_treeWidget->isVisible()) height += (m_filesToRevert.size() * 50); - setMinimumSize(300, min(height, 350)); + setMinimumSize(300, std::min(height, 350)); QString msg = QString(tr("%1 items to revert.")) .arg(m_filesToRevert.size() == 1 diff --git a/toonz/sources/toonz/toolbar.cpp b/toonz/sources/toonz/toolbar.cpp index 4b2c5a1..f701ae3 100755 --- a/toonz/sources/toonz/toolbar.cpp +++ b/toonz/sources/toonz/toolbar.cpp @@ -116,7 +116,7 @@ void Toolbar::updateToolbar() { xsh->getCellRange(colIndex, r0, r1); if (0 <= r0 && r0 <= r1) { // level type depends on previous occupied cell - for (int r = min(r1, rowIndex); r >= r0; r--) { + for (int r = std::min(r1, rowIndex); r >= r0; r--) { TXshCell cell = xsh->getCell(r, colIndex); if (cell.isEmpty()) continue; levelType = cell.m_level->getType(); diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp index f40990b..1f9ed87 100644 --- a/toonz/sources/toonz/xshcolumnviewer.cpp +++ b/toonz/sources/toonz/xshcolumnviewer.cpp @@ -85,11 +85,10 @@ const QSet getLevels(TXshColumn *column) { bool containsRasterLevel(TColumnSelection *selection) { if (!selection || selection->isEmpty()) return false; - set indexes = selection->getIndices(); + std::set indexes = selection->getIndices(); TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet(); - set::iterator it; - for (it = indexes.begin(); it != indexes.end(); it++) { - TXshColumn *col = xsh->getColumn(*it); + for (auto const &e : indexes) { + TXshColumn *col = xsh->getColumn(e); if (!col || col->getColumnType() != TXshColumn::eLevelType) continue; TXshCellColumn *cellCol = col->getCellColumn(); @@ -637,7 +636,7 @@ ColumnArea::DrawHeader::DrawHeader(ColumnArea *nArea, QPainter &nP, int nCol) else isCurrent = m_viewer->getCurrentColumn() == col; - orig = m_viewer->positionToXY(CellPosition(0, max(col, -1))); + orig = m_viewer->positionToXY(CellPosition(0, std::max(col, -1))); } void ColumnArea::DrawHeader::prepare() const { @@ -1525,7 +1524,7 @@ void ColumnArea::drawPaletteColumnHead(QPainter &p, int col) { // AREA TColumnSelection *selection = m_viewer->getColumnSelection(); const Orientation *o = m_viewer->orientation(); - QPoint orig = m_viewer->positionToXY(CellPosition(0, max(col, -1))); + QPoint orig = m_viewer->positionToXY(CellPosition(0, std::max(col, -1))); QString fontName = Preferences::instance()->getInterfaceFont(); if (fontName == "") { @@ -2756,11 +2755,10 @@ void ColumnArea::onSubSampling(QAction *action) { TColumnSelection *selection = m_viewer->getColumnSelection(); TXsheet *xsh = m_viewer->getXsheet(); assert(selection && xsh); - const set indexes = selection->getIndices(); - set::const_iterator it; - for (it = indexes.begin(); it != indexes.end(); it++) { - if (*it < 0) continue; // Ignore camera column - TXshColumn *column = xsh->getColumn(*it); + const std::set indexes = selection->getIndices(); + for (auto const &e : indexes) { + if (e < 0) continue; // Ignore camera column + TXshColumn *column = xsh->getColumn(e); TXshColumn::ColumnType type = column->getColumnType(); if (type != TXshColumn::eLevelType) continue; const QSet levels = getLevels(column); diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp index 6a8903e..73b4460 100644 --- a/toonz/sources/toonz/xsheetviewer.cpp +++ b/toonz/sources/toonz/xsheetviewer.cpp @@ -860,8 +860,10 @@ CellRange XsheetViewer::xyRectToRange(const QRect &rect) const { QRect XsheetViewer::rangeToXYRect(const CellRange &range) const { QPoint from = positionToXY(range.from()); QPoint to = positionToXY(range.to()); - QPoint topLeft = QPoint(min(from.x(), to.x()), min(from.y(), to.y())); - QPoint bottomRight = QPoint(max(from.x(), to.x()), max(from.y(), to.y())); + QPoint topLeft = + QPoint(std::min(from.x(), to.x()), std::min(from.y(), to.y())); + QPoint bottomRight = + QPoint(std::max(from.x(), to.x()), std::max(from.y(), to.y())); return QRect(topLeft, bottomRight); } @@ -1447,8 +1449,8 @@ void XsheetViewer::scrollToRow(int row) { //----------------------------------------------------------------------------- void XsheetViewer::scrollToVerticalRange(int y0, int y1) { - int yMin = min(y0, y1); - int yMax = max(y0, y1); + int yMin = std::min(y0, y1); + int yMax = std::max(y0, y1); QRect visibleRect = m_cellArea->visibleRegion().boundingRect(); if (visibleRect.isEmpty()) return; int visibleTop = visibleRect.top(); diff --git a/toonz/sources/toonzfarm/include/tfarmexecutor.h b/toonz/sources/toonzfarm/include/tfarmexecutor.h index 0f82341..d709815 100644 --- a/toonz/sources/toonzfarm/include/tfarmexecutor.h +++ b/toonz/sources/toonzfarm/include/tfarmexecutor.h @@ -6,7 +6,6 @@ #include "ttcpip.h" #include -using std::string; //============================================================================== diff --git a/toonz/sources/toonzfarm/include/tfarmproxy.h b/toonz/sources/toonzfarm/include/tfarmproxy.h index 4a3b7ad..56deab8 100644 --- a/toonz/sources/toonzfarm/include/tfarmproxy.h +++ b/toonz/sources/toonzfarm/include/tfarmproxy.h @@ -9,8 +9,6 @@ #include #include -using std::string; -using std::vector; #include "texception.h" @@ -34,7 +32,7 @@ public: virtual ~TFarmProxy() {} QString sendToStub(const QString &data); - static int extractArgs(const QString &s, vector &argv); + static int extractArgs(const QString &s, std::vector &argv); protected: QString m_hostName; diff --git a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp index ad75077..cc3b4db 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp @@ -28,9 +28,10 @@ public: void activateTask(const QString &id) override; void restartTask(const QString &id) override; - void getTasks(vector &tasks) override; - void getTasks(const QString &parentId, vector &tasks) override; - void getTasks(const QString &parentId, vector &tasks) override; + void getTasks(std::vector &tasks) override; + void getTasks(const QString &parentId, std::vector &tasks) override; + void getTasks(const QString &parentId, + std::vector &tasks) override; void queryTaskInfo(const QString &id, TFarmTask &task) override; @@ -51,7 +52,7 @@ public: void taskCompleted(const QString &taskId, int exitCode) override; // fills the servers vector with the names of the servers - void getServers(vector &servers) override; + void getServers(std::vector &servers) override; // returns the state of the server whose id has been specified ServerState queryServerState2(const QString &id) override; @@ -166,12 +167,12 @@ void Controller::restartTask(const QString &id) { //------------------------------------------------------------------------------ -void Controller::getTasks(vector &tasks) { +void Controller::getTasks(std::vector &tasks) { QString data("getTasks@vector"); QString reply = sendToStub(data); // la stringa restituita contiene le informazioni desiderate separate da "," - vector argv; + std::vector argv; extractArgs(reply, argv); tasks.clear(); @@ -181,7 +182,8 @@ void Controller::getTasks(vector &tasks) { //------------------------------------------------------------------------------ -void Controller::getTasks(const QString &parentId, vector &tasks) { +void Controller::getTasks(const QString &parentId, + std::vector &tasks) { QString data("getTasks@string@vector"); data += ","; data += parentId; @@ -189,7 +191,7 @@ void Controller::getTasks(const QString &parentId, vector &tasks) { QString reply = sendToStub(data); // la stringa restituita contiene le informazioni deiderate separate da "," - vector argv; + std::vector argv; extractArgs(reply, argv); tasks.clear(); @@ -200,7 +202,7 @@ void Controller::getTasks(const QString &parentId, vector &tasks) { //------------------------------------------------------------------------------ void Controller::getTasks(const QString &parentId, - vector &tasks) { + std::vector &tasks) { QString data("getTasks@string@vector$TaskShortInfo"); data += ","; data += parentId; @@ -208,7 +210,7 @@ void Controller::getTasks(const QString &parentId, QString reply = sendToStub(data); // la stringa restituita contiene le informazioni desiderate separate da "," - vector argv; + std::vector argv; extractArgs(reply, argv); tasks.clear(); @@ -233,7 +235,7 @@ void Controller::queryTaskInfo(const QString &id, TFarmTask &task) { QString reply = sendToStub(data); // la stringa restituita contiene le informazioni desiderate separate da "," - vector argv; + std::vector argv; int count = extractArgs(reply, argv); if (reply == "") return; @@ -283,7 +285,7 @@ void Controller::queryTaskShortInfo(const QString &id, QString &parentId, QString reply = sendToStub(data); // la stringa restituita contiene le informazioni desiderate separate da "," - vector argv; + std::vector argv; extractArgs(reply, argv); assert(argv.size() == 3); @@ -368,12 +370,12 @@ void Controller::taskCompleted(const QString &taskId, int exitCode) { //------------------------------------------------------------------------------ -void Controller::getServers(vector &servers) { +void Controller::getServers(std::vector &servers) { QString data("getServers"); QString reply = sendToStub(data); // la stringa restituita contiene le informazioni desiderate separate da "," - vector argv; + std::vector argv; extractArgs(reply, argv); servers.clear(); @@ -405,7 +407,7 @@ void Controller::queryServerInfo(const QString &id, ServerInfo &info) { QString reply = sendToStub(data); if (reply != "") { // la stringa restituita contiene le informazioni desiderate separate da "," - vector argv; + std::vector argv; extractArgs(reply, argv); info.m_name = argv[0]; diff --git a/toonz/sources/toonzfarm/tfarm/tfarmproxy.cpp b/toonz/sources/toonzfarm/tfarm/tfarmproxy.cpp index bd6da1b..6e611cb 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmproxy.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmproxy.cpp @@ -29,7 +29,7 @@ QString TFarmProxy::sendToStub(const QString &data) { //------------------------------------------------------------------------------ -int TFarmProxy::extractArgs(const QString &s, vector &argv) { +int TFarmProxy::extractArgs(const QString &s, std::vector &argv) { argv.clear(); if (s == "") return 0; @@ -43,7 +43,7 @@ int TFarmProxy::extractArgs(const QString &s, vector &argv) { //============================================================================== TString CantConnectToStub::getMessage() const { - string msg("Unable to connect to "); + std::string msg("Unable to connect to "); msg += m_hostName.toStdString(); msg += " on port "; msg += std::to_string(m_port); diff --git a/toonz/sources/toonzfarm/tfarm/tfarmserver_c.cpp b/toonz/sources/toonzfarm/tfarm/tfarmserver_c.cpp index 5d731b4..1068b31 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmserver_c.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmserver_c.cpp @@ -17,7 +17,7 @@ public: // TFarmServer interface implementation int addTask(const QString &taskid, const QString &cmdline) override; int terminateTask(const QString &taskid) override; - int getTasks(vector &tasks) override; + int getTasks(std::vector &tasks) override; void queryHwInfo(HwInfo &hwInfo) override; @@ -55,12 +55,12 @@ int FarmServerProxy::terminateTask(const QString &taskid) { } //------------------------------------------------------------------------------ -int FarmServerProxy::getTasks(vector &tasks) { +int FarmServerProxy::getTasks(std::vector &tasks) { QString data("getTasks"); QString reply = sendToStub(data); // la stringa restituita contiene le informazioni desiderate separate da "," - vector argv; + std::vector argv; int count = extractArgs(reply, argv); assert(count > 0); @@ -81,7 +81,7 @@ void FarmServerProxy::queryHwInfo(HwInfo &hwInfo) { QString reply = sendToStub(data); // la stringa restituita contiene le informazioni desiderate separate da "," - vector argv; + std::vector argv; extractArgs(reply, argv); assert(argv.size() > 4); diff --git a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp index 4142d71..4acf98e 100644 --- a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp +++ b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp @@ -199,7 +199,7 @@ public: void onStart(int argc, char *argv[]) override; void onStop() override; - void loadControllerData(QString &hostName, string &ipAddr, int &port); + void loadControllerData(QString &hostName, std::string &ipAddr, int &port); #ifdef _WIN32 void loadDiskMountingPoints(const TFilePath &fp); @@ -207,7 +207,7 @@ public: void unmountDisks(); std::map m_disks; - vector m_disksMounted; + std::vector m_disksMounted; #endif int m_port; @@ -288,14 +288,14 @@ public: m_controller = controller; } TFarmController *getController() const { return m_controller.getPointer(); } - void setAppPaths(const vector &); + void setAppPaths(const std::vector &); - QString execute(const vector &argv) override; + QString execute(const std::vector &argv) override; // TFarmServer overrides int addTask(const QString &taskid, const QString &cmdline) override; int terminateTask(const QString &taskid) override; - int getTasks(vector &tasks) override; + int getTasks(std::vector &tasks) override; void queryHwInfo(HwInfo &hwInfo) override; @@ -321,7 +321,7 @@ private: FarmControllerProxyP m_controller; TThread::Mutex m_mux; - vector m_tasks; + std::vector m_tasks; TUserLog *m_userLog; @@ -445,10 +445,7 @@ void Task::run() { // cerco se il nome dell'applicazione e' tra quelle del file di // configurazione - bool foundApp = false; - vector::iterator it = m_server->m_appPaths.begin(); - for (; it != m_server->m_appPaths.end(); ++it) { - TFilePath appPath = *it; + for (auto const &appPath : m_server->m_appPaths) { if (appPath.getName() == appName.toStdString()) { exename = QString::fromStdWString(appPath.getWideString()); break; @@ -512,7 +509,7 @@ FarmServer::FarmServer(int port, TUserLog *log) FarmServer::~FarmServer() { delete m_executor; } //------------------------------------------------------------------------------ -QString FarmServer::execute(const vector &argv) { +QString FarmServer::execute(const std::vector &argv) { if (argv.size() > 0) { if (argv[0] == "addTask" && argv.size() == 3) { // assert(!"Da fare"); @@ -522,15 +519,14 @@ QString FarmServer::execute(const vector &argv) { int ret = terminateTask(argv[1]); return QString::number(ret); } else if (argv[0] == "getTasks") { - vector tasks; + std::vector tasks; int ret = getTasks(tasks); QString reply(QString::number(ret)); reply += ","; - vector::iterator it = tasks.begin(); - for (; it != tasks.end(); ++it) { - reply += *it; + for (auto const &e : tasks) { + reply += e; reply += ","; } @@ -632,7 +628,7 @@ int FarmServer::terminateTask(const QString &taskid) { //------------------------------------------------------------------------------ -int FarmServer::getTasks(vector &tasks) { +int FarmServer::getTasks(std::vector &tasks) { QMutexLocker sl(&m_mux); tasks = m_tasks; return m_tasks.size(); @@ -686,7 +682,7 @@ void FarmServer::detachController(const ControllerData &data) { void FarmServer::removeTask(const QString &id) { QMutexLocker sl(&m_mux); - vector::iterator it = find(m_tasks.begin(), m_tasks.end(), id); + std::vector::iterator it = find(m_tasks.begin(), m_tasks.end(), id); if (it != m_tasks.end()) m_tasks.erase(it); } @@ -1011,7 +1007,7 @@ void FarmServerService::loadDiskMountingPoints(const TFilePath &fp) { while (*t) t++; while (t > s && isBlank(*(t - 1))) t--; if (t == s) continue; // non dovrebbe succedere mai: dst vuoto - string dst(s, t - s); + std::string dst(s, t - s); m_disks[from] = dst; } } @@ -1070,10 +1066,7 @@ void FarmServerService::mountDisks() { //------------------------------------------------------------------------------ void FarmServerService::unmountDisks() { - vector::iterator it = m_disksMounted.begin(); - for (; it != m_disksMounted.end(); ++it) { - std::string drive = *it; - + for (auto const &drive : m_disksMounted) { DWORD res = WNetCancelConnection2(drive.c_str(), // resource name CONNECT_UPDATE_PROFILE, // connection type diff --git a/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp b/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp index 88acca8..4304ef1 100644 --- a/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp +++ b/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp @@ -107,9 +107,6 @@ const unsigned short TFileStatus::IfDir = _S_IFDIR; #define STAT _stat #define UTIME _utime #define FTIME _ftime -using std::ifstream; -using std::ofstream; -using std::filebuf; #else // these are common for IRIX & LINUX const int TSystem::MaxPathLen = MAXPATHLEN; const int TSystem::MaxHostNameLen = MAXHOSTNAMELEN; @@ -744,7 +741,7 @@ void TSystem::touchFile(const TFilePath &path) { if (TFileStatus(path).doesExist()) { if (0 != UTIME(filename.c_str(), 0)) throw TSystemException(path, errno); } else { - ofstream file(filename.c_str()); + std::ofstream file(filename.c_str()); if (!file) { throw TSystemException(path, errno); } @@ -789,8 +786,8 @@ void TSystem::copyFile(const TFilePath &dst, const TFilePath &src) { throw TSystemException(src, getFormattedMessage(GetLastError())); } #else - ifstream fpin(src.getFullPath().c_str(), ios::in); - ofstream fpout(dst.getFullPath().c_str(), ios::out); + std::ifstream fpin(src.getFullPath().c_str(), ios::in); + std::ofstream fpout(dst.getFullPath().c_str(), ios::out); if (!fpin || !fpout) throw TSystemException(src, "unable to copy file"); int c = fpin.get(); while (!fpin.eof()) { diff --git a/toonz/sources/toonzlib/multimediarenderer.cpp b/toonz/sources/toonzlib/multimediarenderer.cpp index a27aea8..199ed55 100644 --- a/toonz/sources/toonzlib/multimediarenderer.cpp +++ b/toonz/sources/toonzlib/multimediarenderer.cpp @@ -60,11 +60,11 @@ public: bool m_canceled; int m_currentFx; - set::iterator m_currentFrame; + std::set::iterator m_currentFrame; TRenderer *m_currentTRenderer; TFxSet m_fxsToRender; - set m_framesToRender; + std::set m_framesToRender; QEventLoop m_eventLoop; diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cpp index ebcbf9c..7f7e79e 100644 --- a/toonz/sources/toonzlib/orientation.cpp +++ b/toonz/sources/toonzlib/orientation.cpp @@ -7,8 +7,6 @@ #include #include -using std::pair; - namespace { const int KEY_ICON_WIDTH = 11; const int KEY_ICON_HEIGHT = 13; @@ -199,11 +197,11 @@ const Orientation *Orientations::topToBottom() { const Orientation *Orientations::leftToRight() { return instance()._leftToRight; } -const vector &Orientations::all() { +const std::vector &Orientations::all() { return instance()._all; } const Orientation *Orientations::byName(const QString &name) { - vector m_all = all(); + std::vector m_all = all(); for (auto it = m_all.begin(); it != m_all.end(); it++) if ((*it)->name() == name) return *it; throw std::runtime_error( @@ -245,31 +243,31 @@ QLine Orientation::foldedRectangleLine(int layerAxis, void Orientation::addRect(PredefinedRect which, const QRect &rect) { _rects.erase(which); - _rects.insert(pair(which, rect)); + _rects.emplace(which, rect); } void Orientation::addLine(PredefinedLine which, const QLine &line) { _lines.erase(which); - _lines.insert(pair(which, line)); + _lines.emplace(which, line); } void Orientation::addDimension(PredefinedDimension which, int dimension) { _dimensions.erase(which); - _dimensions.insert(pair(which, dimension)); + _dimensions.emplace(which, dimension); } void Orientation::addPath(PredefinedPath which, const QPainterPath &path) { _paths.erase(which); - _paths.insert(pair(which, path)); + _paths.emplace(which, path); } void Orientation::addPoint(PredefinedPoint which, const QPoint &point) { _points.erase(which); - _points.insert(pair(which, point)); + _points.emplace(which, point); } void Orientation::addRange(PredefinedRange which, const NumberRange &range) { _ranges.erase(which); - _ranges.insert(pair(which, range)); + _ranges.emplace(which, range); } void Orientation::addFlag(PredefinedFlag which, const bool &flag) { _flags.erase(which); - _flags.insert(pair(which, flag)); + _flags.emplace(which, flag); } /// ------------------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/palettecmd.cpp b/toonz/sources/toonzlib/palettecmd.cpp index 3c62462..19d8db4 100644 --- a/toonz/sources/toonzlib/palettecmd.cpp +++ b/toonz/sources/toonzlib/palettecmd.cpp @@ -48,7 +48,7 @@ //=================================================================== -void findPaletteLevels(set &levels, int &rowIndex, +void findPaletteLevels(std::set &levels, int &rowIndex, int &columnIndex, TPalette *palette, TXsheet *xsheet) { rowIndex = columnIndex = -1; int columnCount = xsheet->getColumnCount(); @@ -136,7 +136,7 @@ bool isStyleUsed(const TImageP image, int styleId) { //=================================================================== /*! Return true if one style is used. */ -bool areStylesUsed(const set levels, +bool areStylesUsed(const std::set levels, const std::vector styleIds) { for (auto const level : levels) { std::vector fids; @@ -497,7 +497,7 @@ void PaletteCmd::addStyles(TPaletteHandle *paletteHandle, int pageIndex, namespace { -void eraseStylesInLevels(const set &levels, +void eraseStylesInLevels(const std::set &levels, const std::vector styleIds) { for (auto const level : levels) { std::vector fids; diff --git a/toonz/sources/toonzlib/tcolumnfx.cpp b/toonz/sources/toonzlib/tcolumnfx.cpp index 2832fa8..800281b 100644 --- a/toonz/sources/toonzlib/tcolumnfx.cpp +++ b/toonz/sources/toonzlib/tcolumnfx.cpp @@ -289,7 +289,8 @@ static int getEnlargement(const std::vector &fxs, //------------------------------------------------------------------- static void applyPaletteFilter(TPalette *&plt, bool keep, - const set &colors, const TPalette *srcPlt) { + const std::set &colors, + const TPalette *srcPlt) { if (colors.empty()) return; if (!plt) plt = srcPlt->clone(); @@ -414,7 +415,7 @@ static TImageP applyCmappedFx(TToonzImageP &ti, PaletteFilterData->m_type == eApplyToInksAndPaints) { bool keep = PaletteFilterData->m_keep; - set colors; + std::set colors; colors.insert(PaletteFilterData->m_colors.begin(), PaletteFilterData->m_colors.end()); @@ -450,7 +451,7 @@ static TImageP applyCmappedFx(TToonzImageP &ti, std::vector indexes; indexes.resize(PaletteFilterData->m_colors.size()); - set::const_iterator jt = PaletteFilterData->m_colors.begin(); + std::set::const_iterator jt = PaletteFilterData->m_colors.begin(); for (int j = 0; j < (int)indexes.size(); ++j, ++jt) indexes[j] = *jt; if (copyRas == TRasterCM32P()) @@ -680,7 +681,7 @@ static void applyCmappedFx(TVectorImageP &vi, TRasterP ras; bool keep = false; TPaletteP modPalette; - set colors; + std::set colors; std::vector::const_iterator it = fxs.begin(); // prima tutti gli effetti che agiscono sulla paletta.... diff --git a/toonz/sources/toonzlib/toonzimageutils.cpp b/toonz/sources/toonzlib/toonzimageutils.cpp index 4f40dc1..3f88cbf 100644 --- a/toonz/sources/toonzlib/toonzimageutils.cpp +++ b/toonz/sources/toonzlib/toonzimageutils.cpp @@ -202,10 +202,10 @@ TRectD ToonzImageUtils::convertRasterToWorld(const TRect area, // overlaying inks, blend inks always "lose" on normal inks -static TRect fastAddInkStroke(const TToonzImageP &ti, TStroke *stroke, - int inkId, bool selective, bool filled, - TRectD clip, bool doAntialiasing = true, - const set &blendInks = set()) { +static TRect fastAddInkStroke( + const TToonzImageP &ti, TStroke *stroke, int inkId, bool selective, + bool filled, TRectD clip, bool doAntialiasing = true, + const std::set &blendInks = std::set()) { TRasterCM32P ras = ti->getRaster(); TOfflineGL *gl = 0; @@ -407,7 +407,7 @@ TToonzImageP ToonzImageUtils::vectorToToonzImage( // In such reference, the clip for rendering strokes is the output size TRectD clip(TDimensionD(outputSize.lx, outputSize.ly)); - set colors; + std::set colors; if (fxs) { for (i = 0; i < (int)fxs->size(); i++) { SandorFxRenderData *sandorData = diff --git a/toonz/sources/toonzlib/trasterimageutils.cpp b/toonz/sources/toonzlib/trasterimageutils.cpp index 61d4912..b0bc575 100644 --- a/toonz/sources/toonzlib/trasterimageutils.cpp +++ b/toonz/sources/toonzlib/trasterimageutils.cpp @@ -264,7 +264,7 @@ TRasterImageP TRasterImageUtils::vectorToFullColorImage( maxStyleId); } - set colors; + std::set colors; if (fxs) { for (i = 0; i < (int)fxs->size(); i++) { SandorFxRenderData *sandorData = diff --git a/toonz/sources/toonzlib/txshsoundlevel.cpp b/toonz/sources/toonzlib/txshsoundlevel.cpp index c282db6..bb75dee 100644 --- a/toonz/sources/toonzlib/txshsoundlevel.cpp +++ b/toonz/sources/toonzlib/txshsoundlevel.cpp @@ -148,7 +148,7 @@ void TXshSoundLevel::saveData(TOStream &os) { void TXshSoundLevel::computeValuesFor(const Orientation *o) { int frameHeight = o->dimension(PredefinedDimension::FRAME); // time axis int index = o->dimension(PredefinedDimension::INDEX); - map &values = m_values[index]; + std::map &values = m_values[index]; if (frameHeight == 0) frameHeight = 1; values.clear(); diff --git a/toonz/sources/toonzqt/stageobjectsdata.cpp b/toonz/sources/toonzqt/stageobjectsdata.cpp index fa5c551..e47747c 100644 --- a/toonz/sources/toonzqt/stageobjectsdata.cpp +++ b/toonz/sources/toonzqt/stageobjectsdata.cpp @@ -690,12 +690,10 @@ void StageObjectsData::storeObjects(const std::vector &ids, } // Insert terminal fxs - set::iterator jt; - for (jt = m_originalColumnFxs.begin(); jt != m_originalColumnFxs.end(); - ++jt) { - if (isColumnSelectionTerminalFx(*jt, xsh->getFxDag()->getTerminalFxs(), + for (auto const &e : m_originalColumnFxs) { + if (isColumnSelectionTerminalFx(e, xsh->getFxDag()->getTerminalFxs(), m_originalColumnFxs)) { - TFx *fx = m_fxTable[*jt]; + TFx *fx = m_fxTable[e]; fx->addRef(); m_terminalFxs.insert(fx);