Commit f9389d62 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Use auto for STL style iterators



Change-Id: I64ed8842587266b44a0cc377b3ac50d40b3633a7
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent e5104799
......@@ -38,7 +38,7 @@ namespace QmlDesigner {
double sum(const QList<double> & list)
{
double sum = 0.0;
for (QList<double>::const_iterator iterator = list.constBegin(); iterator != list.constEnd(); ++iterator)
for (auto iterator = list.constBegin(); iterator != list.constEnd(); ++iterator)
{
sum += *iterator;
}
......
......@@ -50,8 +50,8 @@ namespace QmlDesigner {
PluginManager::IPluginList PluginManager::instances()
{
IPluginList rc;
const PluginPathList::iterator end = m_paths.end();
for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
const auto end = m_paths.end();
for (auto it = m_paths.begin(); it != end; ++it)
it->getInstances(&rc);
if (debug)
qDebug() << '<' << Q_FUNC_INFO << rc.size();
......@@ -78,8 +78,8 @@ void PluginManager::setPluginPaths(const QStringList &paths)
QAbstractItemModel *PluginManager::createModel(QObject *parent)
{
QStandardItemModel *model = new QStandardItemModel(parent);
const PluginPathList::iterator end = m_paths.end();
for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
const auto end = m_paths.end();
for (auto it = m_paths.begin(); it != end; ++it)
model->appendRow(it->createModelItem());
return model;
}
......
......@@ -113,8 +113,8 @@ QStringList PluginPath::libraryFilePaths(const QDir &dir)
// Load symbolic links but make sure all file names are unique as not
// to fall for something like 'libplugin.so.1 -> libplugin.so'
QStringList result;
const QFileInfoList::const_iterator icend = infoList.constEnd();
for (QFileInfoList::const_iterator it = infoList.constBegin(); it != icend; ++it) {
const auto icend = infoList.constEnd();
for (auto it = infoList.constBegin(); it != icend; ++it) {
QString fileName;
if (it->isSymLink()) {
const QFileInfo linkTarget = QFileInfo(it->symLinkTarget());
......@@ -156,8 +156,8 @@ void PluginPath::getInstances(PluginManager::IPluginList *list)
// Compile list of instances
if (m_plugins.empty())
return;
const PluginDataList::iterator end = m_plugins.end();
for (PluginDataList::iterator it = m_plugins.begin(); it != end; ++it)
const auto end = m_plugins.end();
for (auto it = m_plugins.begin(); it != end; ++it)
if (IPlugin *i = instance(*it))
list->push_back(i);
}
......@@ -170,8 +170,8 @@ QStandardItem *PluginPath::createModelItem()
// category at the end
QStandardItem *pathItem = new QStandardItem(m_path.absolutePath());
QStandardItem *failedCategory = 0;
const PluginDataList::iterator end = m_plugins.end();
for (PluginDataList::iterator it = m_plugins.begin(); it != end; ++it) {
const auto end = m_plugins.end();
for (auto it = m_plugins.begin(); it != end; ++it) {
QStandardItem *pluginItem = new QStandardItem(QFileInfo(it->path).fileName());
if (instance(*it)) {
pluginItem->appendRow(new QStandardItem(QString::fromUtf8(it->instanceGuard->metaObject()->className())));
......
......@@ -288,8 +288,8 @@ void SubComponentManager::parseDirectory(const QString &canonicalDirPath, bool a
if (debug)
qDebug() << "monitored list " << monitoredList.size() << "new list " << newList.size();
QList<QFileInfo>::const_iterator oldIter = monitoredList.constBegin();
QList<QFileInfo>::const_iterator newIter = newList.constBegin();
auto oldIter = monitoredList.constBegin();
auto newIter = newList.constBegin();
while (oldIter != monitoredList.constEnd() && newIter != newList.constEnd()) {
const QFileInfo oldFileInfo = *oldIter;
......
......@@ -53,7 +53,7 @@ void ModelNodePositionStorage::cleanupInvalidOffsets()
int ModelNodePositionStorage::nodeOffset(const ModelNode &modelNode)
{
QHash<ModelNode, RewriterData>::const_iterator iter = m_rewriterData.find(modelNode);
auto iter = m_rewriterData.find(modelNode);
if (iter == m_rewriterData.end())
return INVALID_LOCATION;
else
......
......@@ -48,8 +48,8 @@ WidgetPluginManager::WidgetPluginManager()
WidgetPluginManager::IWidgetPluginList WidgetPluginManager::instances()
{
IWidgetPluginList rc;
const PluginPathList::iterator end = m_paths.end();
for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
const auto end = m_paths.end();
for (auto it = m_paths.begin(); it != end; ++it)
it->getInstances(&rc);
if (debug)
qDebug() << '<' << Q_FUNC_INFO << rc.size();
......@@ -68,8 +68,8 @@ bool WidgetPluginManager::addPath(const QString &path)
QAbstractItemModel *WidgetPluginManager::createModel(QObject *parent)
{
QStandardItemModel *model = new QStandardItemModel(parent);
const PluginPathList::iterator end = m_paths.end();
for (PluginPathList::iterator it = m_paths.begin(); it != end; ++it)
const auto end = m_paths.end();
for (auto it = m_paths.begin(); it != end; ++it)
model->appendRow(it->createModelItem());
return model;
}
......
......@@ -131,8 +131,8 @@ QStringList WidgetPluginPath::libraryFilePaths(const QDir &dir)
// Load symbolic links but make sure all file names are unique as not
// to fall for something like 'libplugin.so.1 -> libplugin.so'
QStringList result;
const QFileInfoList::const_iterator icend = infoList.constEnd();
for (QFileInfoList::const_iterator it = infoList.constBegin(); it != icend; ++it) {
const auto icend = infoList.constEnd();
for (auto it = infoList.constBegin(); it != icend; ++it) {
QString fileName;
if (it->isSymLink()) {
const QFileInfo linkTarget = QFileInfo(it->symLinkTarget());
......@@ -175,8 +175,8 @@ void WidgetPluginPath::getInstances(IWidgetPluginList *list)
// Compile list of instances
if (m_plugins.empty())
return;
const PluginDataList::iterator end = m_plugins.end();
for (PluginDataList::iterator it = m_plugins.begin(); it != end; ++it)
const auto end = m_plugins.end();
for (auto it = m_plugins.begin(); it != end; ++it)
if (IWidgetPlugin *i = instance(*it))
list->push_back(i);
}
......@@ -189,8 +189,8 @@ QStandardItem *WidgetPluginPath::createModelItem()
// category at the end
QStandardItem *pathItem = new QStandardItem(m_path.absolutePath());
QStandardItem *failedCategory = 0;
const PluginDataList::iterator end = m_plugins.end();
for (PluginDataList::iterator it = m_plugins.begin(); it != end; ++it) {
const auto end = m_plugins.end();
for (auto it = m_plugins.begin(); it != end; ++it) {
QStandardItem *pluginItem = new QStandardItem(QFileInfo(it->path).fileName());
if (instance(*it)) {
pluginItem->appendRow(new QStandardItem(QString::fromUtf8(it->instanceGuard->metaObject()->className())));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment