Changeset 1095 for s10k/CommonUtils
- Timestamp:
- Dec 30, 2017, 3:30:28 PM (7 years ago)
- Location:
- s10k/CommonUtils
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
s10k/CommonUtils/util.cpp
r1073 r1095 69 69 if (!dir.exists()) 70 70 return true; 71 for each(const QFileInfo &info,dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) {71 for(const QFileInfo &info : dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) { 72 72 if (info.isDir()) { 73 73 if (!rmDir(info.filePath())) … … 181 181 } 182 182 183 bool backupFile(QString file){ 184 return QFile::copy(file,file+".bak"); 183 bool backupFile(const QString &file, QString newFilename){ 184 185 if(newFilename.isEmpty()){ 186 newFilename = file; 187 } 188 189 return QFile::copy(file, newFilename+".bak"); 185 190 } 186 191 … … 334 339 // Check if any string in the list is empty 335 340 bool checkEmptySpaces(QStringList toCheck){ 336 for each (QString current,toCheck){341 for (const QString ¤t : toCheck){ 337 342 if(current.trimmed().isEmpty()){ 338 343 return true; //There are empty spaces … … 343 348 344 349 bool checkIfIntegers(QStringList toCheck){ 345 for each (QString current,toCheck){350 for (const QString ¤t : toCheck){ 346 351 if(!isStringInteger(current)){ 347 352 return true; // Some aren't valid integers … … 352 357 353 358 bool checkIfDoubles(QStringList toCheck){ 354 for each (QString current,toCheck){359 for (const QString ¤t : toCheck){ 355 360 if(!isStringDouble(current)){ 356 361 return true; // Some aren't valid doubles -
s10k/CommonUtils/util.h
r1073 r1095 65 65 QString getAppPath(); 66 66 67 bool backupFile( QString file);67 bool backupFile(const QString &file, QString newFilename=""); 68 68 69 69 }
Note:
See TracChangeset
for help on using the changeset viewer.