Convert remaining foreach to C++11 for loops
This commit is contained in:
parent
57d9c87de6
commit
c5b78dde04
|
@ -61,7 +61,7 @@ void AfcTransfer::CopyFromDevice() {
|
||||||
|
|
||||||
// Copy directories. If one fails we stop.
|
// Copy directories. If one fails we stop.
|
||||||
bool success = true;
|
bool success = true;
|
||||||
foreach (const QString &dir, important_directories_) {
|
for (const QString &dir : important_directories_) {
|
||||||
if (!CopyDirFromDevice(&c, dir)) {
|
if (!CopyDirFromDevice(&c, dir)) {
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
|
@ -82,7 +82,7 @@ bool AfcTransfer::CopyToDevice(iMobileDeviceConnection *connection) {
|
||||||
if (!connection)
|
if (!connection)
|
||||||
connection = new iMobileDeviceConnection(uuid_);
|
connection = new iMobileDeviceConnection(uuid_);
|
||||||
|
|
||||||
foreach (const QString &dir, important_directories_)
|
for (const QString &dir : important_directories_)
|
||||||
if (!CopyDirToDevice(connection, dir))
|
if (!CopyDirToDevice(connection, dir))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -92,12 +92,12 @@ bool AfcTransfer::CopyToDevice(iMobileDeviceConnection *connection) {
|
||||||
|
|
||||||
bool AfcTransfer::CopyDirFromDevice(iMobileDeviceConnection *c, const QString &path) {
|
bool AfcTransfer::CopyDirFromDevice(iMobileDeviceConnection *c, const QString &path) {
|
||||||
|
|
||||||
foreach (const QString &filename, c->ReadDirectory(path, QDir::Files | QDir::NoDotAndDotDot)) {
|
for (const QString &filename : c->ReadDirectory(path, QDir::Files | QDir::NoDotAndDotDot)) {
|
||||||
if (!CopyFileFromDevice(c, path + "/" + filename))
|
if (!CopyFileFromDevice(c, path + "/" + filename))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const QString &dir, c->ReadDirectory(path, QDir::Dirs | QDir::NoDotAndDotDot)) {
|
for (const QString &dir : c->ReadDirectory(path, QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||||
if (!CopyDirFromDevice(c, path + "/" + dir))
|
if (!CopyDirFromDevice(c, path + "/" + dir))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,12 +113,12 @@ bool AfcTransfer::CopyDirToDevice(iMobileDeviceConnection *c, const QString &pat
|
||||||
c->MkDir(path);
|
c->MkDir(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const QString &filename, dir.entryList(QDir::Files | QDir::NoDotAndDotDot)) {
|
for (const QString &filename : dir.entryList(QDir::Files | QDir::NoDotAndDotDot)) {
|
||||||
if (!CopyFileToDevice(c, path + "/" + filename))
|
if (!CopyFileToDevice(c, path + "/" + filename))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const QString &dir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
for (const QString &dir : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||||
if (!CopyDirToDevice(c, path + "/" + dir))
|
if (!CopyDirToDevice(c, path + "/" + dir))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ std::ostream& operator <<(std::ostream& stream, const QNetworkRequest& req);
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::ostream& operator <<(std::ostream& stream, const QList<T>& list) {
|
std::ostream& operator <<(std::ostream& stream, const QList<T>& list) {
|
||||||
stream << "QList(";
|
stream << "QList(";
|
||||||
foreach (const T& item, list) {
|
for (const T& item : list) {
|
||||||
stream << item << ",";
|
stream << item << ",";
|
||||||
}
|
}
|
||||||
stream << ")";
|
stream << ")";
|
||||||
|
|
Loading…
Reference in New Issue