Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Remove some using declaration of std (#3083)

otakuto158f9fbc7815
diff --git a/toonz/sources/common/tcore/tthread_nt.cpp b/toonz/sources/common/tcore/tthread_nt.cpp
index 23d895f19..18919f5b2 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 <windows.h>
-using std::list<TThread *>;
-
class TThreadGroupImp;
//---------------------------------------------------------------------------
// TMutex & TMutexImp
@@ -24,7 +22,7 @@ public:
//---------------------------------------------------------------------------
class TThreadGroupImp {
- list<TThread *> threads;
+ std::list<TThread *> threads;
public:
TThreadGroupImp();
@@ -274,7 +272,7 @@ void TThreadGroupImp::wait() {
if (count == 0) return;
HANDLE *hThreads = new HANDLE[count];
int id = 0;
- for (list<TThread *>::iterator it = threads.begin(); it != threads.end();
+ for (std::list<TThread *>::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 9547a5d57..4eb219ae2 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 a8114fae9..ad56cbeda 100644
--- a/toonz/sources/common/tsystem/tlogger.cpp
+++ b/toonz/sources/common/tsystem/tlogger.cpp
@@ -10,8 +10,6 @@
#include <vector>
#include <QTimer>
-using std::endl;
-
class TLogger::Imp {
public:
std::vector<TLogger::Message> m_messages;
diff --git a/toonz/sources/include/cellposition.h b/toonz/sources/include/cellposition.h
index 3a39eaea1..1aa15b5a9 100644
--- a/toonz/sources/include/cellposition.h
+++ b/toonz/sources/include/cellposition.h
@@ -5,9 +5,6 @@
#include <algorithm>
-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 719950129..86ac2aa05 100644
--- a/toonz/sources/include/orientation.h
+++ b/toonz/sources/include/orientation.h
@@ -23,9 +23,6 @@
#include <map>
#include <vector>
-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<PredefinedRect, QRect> _rects;
- map<PredefinedLine, QLine> _lines;
- map<PredefinedDimension, int> _dimensions;
- map<PredefinedPath, QPainterPath> _paths;
- map<PredefinedPoint, QPoint> _points;
- map<PredefinedRange, NumberRange> _ranges;
- map<PredefinedFlag, bool> _flags;
+ std::map<PredefinedRect, QRect> _rects;
+ std::map<PredefinedLine, QLine> _lines;
+ std::map<PredefinedDimension, int> _dimensions;
+ std::map<PredefinedPath, QPainterPath> _paths;
+ std::map<PredefinedPoint, QPoint> _points;
+ std::map<PredefinedRange, NumberRange> _ranges;
+ std::map<PredefinedFlag, bool> _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<const Orientation *> _all;
+ std::vector<const Orientation *> _all;
Orientations();
@@ -297,7 +295,7 @@ public:
static const Orientation *topToBottom();
static const Orientation *leftToRight();
- static const vector<const Orientation *> &all();
+ static const std::vector<const Orientation *> &all();
static const Orientation *byName(const QString &name);
};
diff --git a/toonz/sources/include/tfarmcontroller.h b/toonz/sources/include/tfarmcontroller.h
index 4c9e4cb58..2e72285f7 100644
--- a/toonz/sources/include/tfarmcontroller.h
+++ b/toonz/sources/include/tfarmcontroller.h
@@ -5,8 +5,6 @@
#include <vector>
-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<QString> &tasks) = 0;
- virtual void getTasks(const QString &parentId, vector<QString> &tasks) = 0;
+ virtual void getTasks(std::vector<QString> &tasks) = 0;
+ virtual void getTasks(const QString &parentId,
+ std::vector<QString> &tasks) = 0;
virtual void getTasks(const QString &parentId,
- vector<TaskShortInfo> &tasks) = 0;
+ std::vector<TaskShortInfo> &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<ServerIdentity> &servers) = 0;
+ virtual void getServers(std::vector<ServerIdentity> &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 d61f07b54..d90475410 100644
--- a/toonz/sources/include/tnotanimatableparam.h
+++ b/toonz/sources/include/tnotanimatableparam.h
@@ -95,15 +95,14 @@ typedef TNotAnimatableParamObserver<TFilePath> TFilePathParamObserver;
//-----------------------------------------------------------------------------
// TNotAnimatableParam base class
//-----------------------------------------------------------------------------
-using std::set;
template <class T>
class DVAPI TNotAnimatableParam : public TParam {
T m_defaultValue, m_value;
protected:
- set<TNotAnimatableParamObserver<T> *> m_observers;
- set<TParamObserver *> m_paramObservers;
+ std::set<TNotAnimatableParamObserver<T> *> m_observers;
+ std::set<TParamObserver *> m_paramObservers;
public:
TNotAnimatableParam(T def = T())
diff --git a/toonz/sources/stopmotion/stopmotion.cpp b/toonz/sources/stopmotion/stopmotion.cpp
index c0ebe69ce..b400ece3f 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 dabd9375e..bebf83d08 100644
--- a/toonz/sources/tnztools/strokeselection.cpp
+++ b/toonz/sources/tnztools/strokeselection.cpp
@@ -454,10 +454,9 @@ void StrokeSelection::removeEndpoints() {
std::vector<std::pair<int, TStroke *>> undoData;
m_vi->findRegions();
- set<int>::iterator it = m_indexes.begin();
- for (; it != m_indexes.end(); ++it) {
- TStroke *s = m_vi->removeEndpoints(*it);
- if (s) undoData.push_back(std::pair<int, TStroke *>(*it, s));
+ for (auto const &e : m_indexes) {
+ TStroke *s = m_vi->removeEndpoints(e);
+ if (s) undoData.push_back(std::pair<int, TStroke *>(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 766a7a024..0fc6ae4fb 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 ea408040e..1fdd8e0f7 100644
--- a/toonz/sources/toonz/batches.cpp
+++ b/toonz/sources/toonz/batches.cpp
@@ -135,7 +135,7 @@ bool SaveTaskListPopup::execute() {
//------------------------------------------------------------------------------
QMutex TasksMutex;
-map<QString, QProcess *> RunningTasks;
+std::map<QString, QProcess *> 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<std::string, string> attr;
+ std::map<std::string, std::string> 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<QString> &tasks) override;
+ void getTasks(std::vector<QString> &tasks) override;
void getTasks(const QString &parentId, std::vector<QString> &tasks) override;
void getTasks(const QString &parentId,
std::vector<TaskShortInfo> &tasks) override;
@@ -1068,7 +1068,9 @@ public:
void taskCompleted(const QString &taskId, int exitCode) override;
- void getServers(vector<ServerIdentity> &servers) override { assert(false); }
+ void getServers(std::vector<ServerIdentity> &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<QString> &tasks) { assert(false); }
+void MyLocalController::getTasks(std::vector<QString> &tasks) { assert(false); }
void MyLocalController::getTasks(const QString &parentId,
std::vector<QString> &tasks) {
diff --git a/toonz/sources/toonz/batches.h b/toonz/sources/toonz/batches.h
index e8513a8a9..05fb72f76 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<QString, TFarmTask *> m_tasks;
- set<Observer *> m_observers;
+ std::set<Observer *> m_observers;
int m_localControllerPortNumber;
TFarmController *m_controller;
std::map<QString, QString> m_farmIdsTable;
diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp
index 7ce9319ad..27a622999 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<TFrameId> &frameIds, int r0,
+ const std::set<TFrameId> &frameIds, int r0,
int c0) {
int frameToInsert = frameIds.size();
xsh->insertCells(r0, c0, frameToInsert);
- set<TFrameId>::const_iterator it;
+ std::set<TFrameId>::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<TFrameId> m_frameIds;
+ std::set<TFrameId> m_frameIds;
TXshSimpleLevelP m_level;
public:
- PasteDrawingsInCellUndo(TXshSimpleLevel *level, const set<TFrameId> &frameIds,
- int r0, int c0)
+ PasteDrawingsInCellUndo(TXshSimpleLevel *level,
+ const std::set<TFrameId> &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<TFrameId> frameIds;
+ std::set<TFrameId> 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<TFrameId> frameIds;
+ std::set<TFrameId> frameIds;
drawingData->getFrames(frameIds);
- int r = r0;
- for (set<TFrameId>::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 102e33e22..8da1f7f3d 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<TFilePath> paths;
+ std::vector<TFilePath> 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 fa6f009ea..65cae7b50 100644
--- a/toonz/sources/toonz/subscenecommand.cpp
+++ b/toonz/sources/toonz/subscenecommand.cpp
@@ -254,11 +254,9 @@ public:
//-----------------------------------------------------------------------------
void getFxConnections(QMap<TFx *, FxConnections> &fxConnetcions,
- const set<TFx *> &fxs, TXsheet *xsh) {
+ const std::set<TFx *> &fxs, TXsheet *xsh) {
TFxSet *terminalFxs = xsh->getFxDag()->getTerminalFxs();
- set<TFx *>::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<int> explodeStageObjects(
+std::set<int> explodeStageObjects(
TXsheet *xsh, TXsheet *subXsh, int index, const TStageObjectId &parentId,
const GroupData &objGroupData, const TPointD &subPos,
const GroupData &fxGroupData, QList<TStageObject *> &pegObjects,
@@ -698,7 +696,7 @@ set<int> explodeStageObjects(
FxDag *innerDag = subXsh->getFxDag();
FxDag *outerDag = xsh->getFxDag();
TStageObjectId tmpParentId = parentId;
- set<int> indexes;
+ std::set<int> 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<int> explode(TXsheet *xsh, TXsheet *subXsh, int index,
- const TStageObjectId &parentId, const GroupData &objGroupData,
- const TPointD &stageSubPos, const GroupData &fxGroupData,
- const TPointD &fxSubPos, QList<TStageObject *> &pegObjects,
- QMap<TStageObjectSpline *, TStageObjectSpline *> &splines,
- const std::vector<TFxPort *> &outPorts, bool onlyColumn,
- bool linkToXsheet) {
+std::set<int> explode(TXsheet *xsh, TXsheet *subXsh, int index,
+ const TStageObjectId &parentId,
+ const GroupData &objGroupData, const TPointD &stageSubPos,
+ const GroupData &fxGroupData, const TPointD &fxSubPos,
+ QList<TStageObject *> &pegObjects,
+ QMap<TStageObjectSpline *, TStageObjectSpline *> &splines,
+ const std::vector<TFxPort *> &outPorts, bool onlyColumn,
+ bool linkToXsheet) {
// innerFx->outerFxs
QMap<TFx *, QPair<TFx *, int>> fxs;
- set<int> indexes = explodeStageObjects(xsh, subXsh, index, parentId,
- objGroupData, stageSubPos, fxGroupData,
- pegObjects, fxs, splines, onlyColumn);
+ std::set<int> 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<int> columnIndices = columnSelection->getIndices();
- std::set<int>::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<TFx *> m_fxs;
+ std::set<TFx *> m_fxs;
QMap<TFx *, FxConnections> m_fxConnections;
public:
@@ -1632,7 +1629,7 @@ public:
const QMap<TFx *, QList<TFxPort *>> &columnOutputConnections,
const QMap<TStageObjectId, QList<TStageObjectId>> children,
const QMap<TStageObjectId, TStageObjectId> &parents,
- const set<TFx *> &fxs,
+ const std::set<TFx *> &fxs,
const QMap<TFx *, FxConnections> fxConnections)
: CollapseUndo(indices, c0, data, newData, columnOutputConnections,
children, parents)
@@ -1640,8 +1637,7 @@ public:
, m_fxConnections(fxConnections) {}
~CollapseFxUndo() {
- set<TFx *>::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<TFx *>::const_iterator it;
- for (it = m_fxs.begin(); it != m_fxs.end(); it++)
- if (!internalFxs->containsFx((*it))) {
- TOutputFx *outFx = dynamic_cast<TOutputFx *>(*it);
+ for (auto const &e : m_fxs)
+ if (!internalFxs->containsFx(e)) {
+ TOutputFx *outFx = dynamic_cast<TOutputFx *>(e);
if (outFx)
xsh->getFxDag()->addOutputFx(outFx);
else
- internalFxs->addFx((*it));
+ internalFxs->addFx(e);
}
QMap<TFx *, FxConnections>::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<int> indexes = m_newIndexs;
+ std::set<int> indexes = m_newIndexs;
for (i = m_pegObjects.size() - 1; i >= 0; i--)
xsh->getStageObjectTree()->insertStageObject(m_pegObjects[i]);
QMap<TStageObjectSpline *, TStageObjectSpline *>::const_iterator it3;
@@ -2081,7 +2076,7 @@ public:
TApp *app = TApp::instance();
TXsheet *xsh = app->getCurrentXsheet()->getXsheet();
- set<int> indexesToRemove = m_newIndexs;
+ std::set<int> 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<int> indexes;
+ std::set<int> 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<int> indexes = m_newIndexs;
+ std::set<int> 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<int>::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<TOutputFx *> oldOutFxs;
+ std::set<TOutputFx *> 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<int> newIndexes =
+ std::set<int> 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<int> newIndexes = ::explode(
+ std::set<int> 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 a9e17ea86..9d7cb85e9 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 e3e0da7b3..06f04f07e 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 819030b4a..3c4f110c2 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 41feb4e84..02a64e5b5 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 4b2c5a137..f701ae3f7 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 f40990b80..1f9ed8700 100644
--- a/toonz/sources/toonz/xshcolumnviewer.cpp
+++ b/toonz/sources/toonz/xshcolumnviewer.cpp
@@ -85,11 +85,10 @@ const QSet<TXshSimpleLevel *> getLevels(TXshColumn *column) {
bool containsRasterLevel(TColumnSelection *selection) {
if (!selection || selection->isEmpty()) return false;
- set<int> indexes = selection->getIndices();
+ std::set<int> indexes = selection->getIndices();
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
- set<int>::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<int> indexes = selection->getIndices();
- set<int>::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<int> 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<TXshSimpleLevel *> levels = getLevels(column);
diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp
index 6a8903e95..73b446094 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 0f82341bf..d709815b7 100644
--- a/toonz/sources/toonzfarm/include/tfarmexecutor.h
+++ b/toonz/sources/toonzfarm/include/tfarmexecutor.h
@@ -6,7 +6,6 @@
#include "ttcpip.h"
#include <string>
-using std::string;
//==============================================================================
diff --git a/toonz/sources/toonzfarm/include/tfarmproxy.h b/toonz/sources/toonzfarm/include/tfarmproxy.h
index 4a3b7ad03..56deab8dc 100644
--- a/toonz/sources/toonzfarm/include/tfarmproxy.h
+++ b/toonz/sources/toonzfarm/include/tfarmproxy.h
@@ -9,8 +9,6 @@
#include <string>
#include <vector>
-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<QString> &argv);
+ static int extractArgs(const QString &s, std::vector<QString> &argv);
protected:
QString m_hostName;
diff --git a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp
index ad75077f4..cc3b4db27 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<QString> &tasks) override;
- void getTasks(const QString &parentId, vector<QString> &tasks) override;
- void getTasks(const QString &parentId, vector<TaskShortInfo> &tasks) override;
+ void getTasks(std::vector<QString> &tasks) override;
+ void getTasks(const QString &parentId, std::vector<QString> &tasks) override;
+ void getTasks(const QString &parentId,
+ std::vector<TaskShortInfo> &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<ServerIdentity> &servers) override;
+ void getServers(std::vector<ServerIdentity> &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<QString> &tasks) {
+void Controller::getTasks(std::vector<QString> &tasks) {
QString data("getTasks@vector");
QString reply = sendToStub(data);
// la stringa restituita contiene le informazioni desiderate separate da ","
- vector<QString> argv;
+ std::vector<QString> argv;
extractArgs(reply, argv);
tasks.clear();
@@ -181,7 +182,8 @@ void Controller::getTasks(vector<QString> &tasks) {
//------------------------------------------------------------------------------
-void Controller::getTasks(const QString &parentId, vector<QString> &tasks) {
+void Controller::getTasks(const QString &parentId,
+ std::vector<QString> &tasks) {
QString data("getTasks@string@vector");
data += ",";
data += parentId;
@@ -189,7 +191,7 @@ void Controller::getTasks(const QString &parentId, vector<QString> &tasks) {
QString reply = sendToStub(data);
// la stringa restituita contiene le informazioni deiderate separate da ","
- vector<QString> argv;
+ std::vector<QString> argv;
extractArgs(reply, argv);
tasks.clear();
@@ -200,7 +202,7 @@ void Controller::getTasks(const QString &parentId, vector<QString> &tasks) {
//------------------------------------------------------------------------------
void Controller::getTasks(const QString &parentId,
- vector<TaskShortInfo> &tasks) {
+ std::vector<TaskShortInfo> &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<QString> argv;
+ std::vector<QString> 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<QString> argv;
+ std::vector<QString> 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<QString> argv;
+ std::vector<QString> argv;
extractArgs(reply, argv);
assert(argv.size() == 3);
@@ -368,12 +370,12 @@ void Controller::taskCompleted(const QString &taskId, int exitCode) {
//------------------------------------------------------------------------------
-void Controller::getServers(vector<ServerIdentity> &servers) {
+void Controller::getServers(std::vector<ServerIdentity> &servers) {
QString data("getServers");
QString reply = sendToStub(data);
// la stringa restituita contiene le informazioni desiderate separate da ","
- vector<QString> argv;
+ std::vector<QString> 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<QString> argv;
+ std::vector<QString> 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 bd6da1b38..6e611cb63 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<QString> &argv) {
+int TFarmProxy::extractArgs(const QString &s, std::vector<QString> &argv) {
argv.clear();
if (s == "") return 0;
@@ -43,7 +43,7 @@ int TFarmProxy::extractArgs(const QString &s, vector<QString> &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 5d731b4e2..1068b31ce 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<QString> &tasks) override;
+ int getTasks(std::vector<QString> &tasks) override;
void queryHwInfo(HwInfo &hwInfo) override;
@@ -55,12 +55,12 @@ int FarmServerProxy::terminateTask(const QString &taskid) {
}
//------------------------------------------------------------------------------
-int FarmServerProxy::getTasks(vector<QString> &tasks) {
+int FarmServerProxy::getTasks(std::vector<QString> &tasks) {
QString data("getTasks");
QString reply = sendToStub(data);
// la stringa restituita contiene le informazioni desiderate separate da ","
- vector<QString> argv;
+ std::vector<QString> 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<QString> argv;
+ std::vector<QString> 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 4142d717b..4acf98e56 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<std::string, std::string> m_disks;
- vector<std::string> m_disksMounted;
+ std::vector<std::string> 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<TFilePath> &);
+ void setAppPaths(const std::vector<TFilePath> &);
- QString execute(const vector<QString> &argv) override;
+ QString execute(const std::vector<QString> &argv) override;
// TFarmServer overrides
int addTask(const QString &taskid, const QString &cmdline) override;
int terminateTask(const QString &taskid) override;
- int getTasks(vector<QString> &tasks) override;
+ int getTasks(std::vector<QString> &tasks) override;
void queryHwInfo(HwInfo &hwInfo) override;
@@ -321,7 +321,7 @@ private:
FarmControllerProxyP m_controller;
TThread::Mutex m_mux;
- vector<QString> m_tasks;
+ std::vector<QString> 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<TFilePath>::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<QString> &argv) {
+QString FarmServer::execute(const std::vector<QString> &argv) {
if (argv.size() > 0) {
if (argv[0] == "addTask" && argv.size() == 3) {
// assert(!"Da fare");
@@ -522,15 +519,14 @@ QString FarmServer::execute(const vector<QString> &argv) {
int ret = terminateTask(argv[1]);
return QString::number(ret);
} else if (argv[0] == "getTasks") {
- vector<QString> tasks;
+ std::vector<QString> tasks;
int ret = getTasks(tasks);
QString reply(QString::number(ret));
reply += ",";
- vector<QString>::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<QString> &tasks) {
+int FarmServer::getTasks(std::vector<QString> &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<QString>::iterator it = find(m_tasks.begin(), m_tasks.end(), id);
+ std::vector<QString>::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<std::string>::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 88acca869..4304ef144 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 a27aea8b7..199ed5569 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<double>::iterator m_currentFrame;
+ std::set<double>::iterator m_currentFrame;
TRenderer *m_currentTRenderer;
TFxSet m_fxsToRender;
- set<double> m_framesToRender;
+ std::set<double> m_framesToRender;
QEventLoop m_eventLoop;
diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cpp
index ebcbf9c99..7f7e79efb 100644
--- a/toonz/sources/toonzlib/orientation.cpp
+++ b/toonz/sources/toonzlib/orientation.cpp
@@ -7,8 +7,6 @@
#include <math.h>
#include <stdexcept>
-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<const Orientation *> &Orientations::all() {
+const std::vector<const Orientation *> &Orientations::all() {
return instance()._all;
}
const Orientation *Orientations::byName(const QString &name) {
- vector<const Orientation *> m_all = all();
+ std::vector<const Orientation *> 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<PredefinedRect, QRect>(which, rect));
+ _rects.emplace(which, rect);
}
void Orientation::addLine(PredefinedLine which, const QLine &line) {
_lines.erase(which);
- _lines.insert(pair<PredefinedLine, QLine>(which, line));
+ _lines.emplace(which, line);
}
void Orientation::addDimension(PredefinedDimension which, int dimension) {
_dimensions.erase(which);
- _dimensions.insert(pair<PredefinedDimension, int>(which, dimension));
+ _dimensions.emplace(which, dimension);
}
void Orientation::addPath(PredefinedPath which, const QPainterPath &path) {
_paths.erase(which);
- _paths.insert(pair<PredefinedPath, QPainterPath>(which, path));
+ _paths.emplace(which, path);
}
void Orientation::addPoint(PredefinedPoint which, const QPoint &point) {
_points.erase(which);
- _points.insert(pair<PredefinedPoint, QPoint>(which, point));
+ _points.emplace(which, point);
}
void Orientation::addRange(PredefinedRange which, const NumberRange &range) {
_ranges.erase(which);
- _ranges.insert(pair<PredefinedRange, NumberRange>(which, range));
+ _ranges.emplace(which, range);
}
void Orientation::addFlag(PredefinedFlag which, const bool &flag) {
_flags.erase(which);
- _flags.insert(pair<PredefinedFlag, bool>(which, flag));
+ _flags.emplace(which, flag);
}
/// -------------------------------------------------------------------------------
diff --git a/toonz/sources/toonzlib/palettecmd.cpp b/toonz/sources/toonzlib/palettecmd.cpp
index 3c624624e..19d8db440 100644
--- a/toonz/sources/toonzlib/palettecmd.cpp
+++ b/toonz/sources/toonzlib/palettecmd.cpp
@@ -48,7 +48,7 @@
//===================================================================
-void findPaletteLevels(set<TXshSimpleLevel *> &levels, int &rowIndex,
+void findPaletteLevels(std::set<TXshSimpleLevel *> &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<TXshSimpleLevel *> levels,
+bool areStylesUsed(const std::set<TXshSimpleLevel *> levels,
const std::vector<int> styleIds) {
for (auto const level : levels) {
std::vector<TFrameId> fids;
@@ -497,7 +497,7 @@ void PaletteCmd::addStyles(TPaletteHandle *paletteHandle, int pageIndex,
namespace {
-void eraseStylesInLevels(const set<TXshSimpleLevel *> &levels,
+void eraseStylesInLevels(const std::set<TXshSimpleLevel *> &levels,
const std::vector<int> styleIds) {
for (auto const level : levels) {
std::vector<TFrameId> fids;
diff --git a/toonz/sources/toonzlib/tcolumnfx.cpp b/toonz/sources/toonzlib/tcolumnfx.cpp
index 2832fa8bd..800281b91 100644
--- a/toonz/sources/toonzlib/tcolumnfx.cpp
+++ b/toonz/sources/toonzlib/tcolumnfx.cpp
@@ -289,7 +289,8 @@ static int getEnlargement(const std::vector<TRasterFxRenderDataP> &fxs,
//-------------------------------------------------------------------
static void applyPaletteFilter(TPalette *&plt, bool keep,
- const set<int> &colors, const TPalette *srcPlt) {
+ const std::set<int> &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<int> colors;
+ std::set<int> colors;
colors.insert(PaletteFilterData->m_colors.begin(),
PaletteFilterData->m_colors.end());
@@ -450,7 +451,7 @@ static TImageP applyCmappedFx(TToonzImageP &ti,
std::vector<int> indexes;
indexes.resize(PaletteFilterData->m_colors.size());
- set<int>::const_iterator jt = PaletteFilterData->m_colors.begin();
+ std::set<int>::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<int> colors;
+ std::set<int> colors;
std::vector<TRasterFxRenderDataP>::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 4f40dc141..3f88cbfb3 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<int> &blendInks = set<int>()) {
+static TRect fastAddInkStroke(
+ const TToonzImageP &ti, TStroke *stroke, int inkId, bool selective,
+ bool filled, TRectD clip, bool doAntialiasing = true,
+ const std::set<int> &blendInks = std::set<int>()) {
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<int> colors;
+ std::set<int> 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 61d4912a4..b0bc575a2 100644
--- a/toonz/sources/toonzlib/trasterimageutils.cpp
+++ b/toonz/sources/toonzlib/trasterimageutils.cpp
@@ -264,7 +264,7 @@ TRasterImageP TRasterImageUtils::vectorToFullColorImage(
maxStyleId);
}
- set<int> colors;
+ std::set<int> 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 c282db6f2..bb75dee47 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<int, DoublePair> &values = m_values[index];
+ std::map<int, DoublePair> &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 fa5c55124..e47747ce6 100644
--- a/toonz/sources/toonzqt/stageobjectsdata.cpp
+++ b/toonz/sources/toonzqt/stageobjectsdata.cpp
@@ -690,12 +690,10 @@ void StageObjectsData::storeObjects(const std::vector<TStageObjectId> &ids,
}
// Insert terminal fxs
- set<TFx *>::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);