Commit 7c9ace46935002dac5c1340a16be154ce022c060

Authored by Charles Otto
1 parent 17eabb71

Spaces between control structures and (, some updated braces

openbr/core/core.cpp
... ... @@ -305,7 +305,7 @@ struct AlgorithmCore
305 305 tail.removeFirst();
306 306  
307 307 QStringList toRemove;
308   - foreach(const QString &s, tail)
  308 + foreach (const QString &s, tail)
309 309 toRemove.append(s.split(',').at(1));
310 310  
311 311 QSet<QString> duplicates = QSet<QString>::fromList(toRemove);
... ... @@ -313,7 +313,7 @@ struct AlgorithmCore
313 313 QStringList fileNames = inputFiles.names();
314 314  
315 315 QList<int> indices;
316   - foreach(const QString &d, duplicates)
  316 + foreach (const QString &d, duplicates)
317 317 indices.append(fileNames.indexOf(d));
318 318  
319 319 std::sort(indices.begin(),indices.end(),std::greater<float>());
... ... @@ -426,10 +426,8 @@ struct AlgorithmCore
426 426 // which compares incoming templates against a gallery, we will handle enrollment of the row set by simply
427 427 // building a transform that does enrollment (using the current algorithm), then does the comparison in one
428 428 // step. This way, we don't have to retain the complete enrolled row gallery in memory, or on disk.
429   - else if(!(QStringList() << "gal" << "mem" << "template").contains(rowGallery.suffix()))
430   - {
  429 + else if (!(QStringList() << "gal" << "mem" << "template").contains(rowGallery.suffix()))
431 430 needEnrollRows = true;
432   - }
433 431  
434 432 // At this point, we have decided how we will structure the comparison (either in transpose mode, or not),
435 433 // and have the column gallery enrolled, and have decided whether or not we need to enroll the row gallery.
... ...
openbr/core/eval.cpp
... ... @@ -332,16 +332,14 @@ float InplaceEval(const QString &amp;simmat, const QString &amp;target, const QString &amp;q
332 332  
333 333 qint64 idx = 0;
334 334 bool done = false;
335   - do
336   - {
  335 + do {
337 336 TemplateList temp = columnGal->readBlock(&done);
338 337 QStringList tempLabels = File::get<QString>(temp, "Label");
339 338  
340   - foreach(QString st, tempLabels)
341   - {
342   - if (!galleryIndices.contains(st)) {
  339 + foreach (QString st, tempLabels) {
  340 + if (!galleryIndices.contains(st))
343 341 galleryIndices.insert(st, QList<qint64>());
344   - }
  342 +
345 343 galleryIndices[st].append(idx);
346 344 idx++;
347 345 }
... ... @@ -357,21 +355,17 @@ float InplaceEval(const QString &amp;simmat, const QString &amp;target, const QString &amp;q
357 355 probeGallery->set_readBlockSize(10000);
358 356 done = false;
359 357 qint64 row_count = 0;
360   - do
361   - {
  358 + do {
362 359 TemplateList temp = probeGallery->readBlock(&done);
363 360 QStringList probeLabels = File::get<QString>(temp, "Label");
364 361  
365   - for (int i=0; i < probeLabels.size();i++)
366   - {
  362 + for (int i=0; i < probeLabels.size();i++) {
367 363 row_count++;
368   - if (!galleryIndices.contains(probeLabels[i])) {
  364 + if (!galleryIndices.contains(probeLabels[i]))
369 365 continue;
370   - }
371 366  
372 367 QList<qint64> colMask = galleryIndices[probeLabels[i]];
373   - foreach(qint64 colID, colMask)
374   - {
  368 + foreach (qint64 colID, colMask) {
375 369 float score;
376 370 file.seek(data_pos + i * rowSize + colID * typeSize);
377 371 file.read((char *) &score, sizeof(float));
... ... @@ -383,7 +377,7 @@ float InplaceEval(const QString &amp;simmat, const QString &amp;target, const QString &amp;q
383 377 }
384 378 }
385 379  
386   - } while(!done);
  380 + } while (!done);
387 381  
388 382 QMap<float, GenImpCounts> noImpostors = genScoresToCounts;
389 383  
... ... @@ -403,16 +397,14 @@ float InplaceEval(const QString &amp;simmat, const QString &amp;target, const QString &amp;q
403 397 Mat blockMat(bSize, cols, CV_32FC1);
404 398  
405 399 qint64 bCount = 0;
406   - do
407   - {
  400 + do {
408 401 bCount++;
409 402 TemplateList temp = probeGallery2->readBlock(&done);
410 403 QStringList probeLabels = File::get<QString>(temp, "Label");
411 404 temp.clear();
412 405  
413 406 file.read((char *) blockMat.data, rowSize * probeLabels.length());
414   - for (int i=0; i < probeLabels.size();i++)
415   - {
  407 + for (int i=0; i < probeLabels.size();i++) {
416 408 row_count++;
417 409 aRow = blockMat.row(i);
418 410  
... ... @@ -445,8 +437,7 @@ float InplaceEval(const QString &amp;simmat, const QString &amp;target, const QString &amp;q
445 437 i->impCount++;
446 438 }
447 439 }
448   -
449   - } while(!done);
  440 + } while (!done);
450 441  
451 442 QList<OperatingPoint> operatingPoints;
452 443 qint64 genAccum = 0;
... ...
openbr/core/qtutils.cpp
... ... @@ -105,9 +105,9 @@ void writeFile(const QString &amp;file, const QStringList &amp;lines)
105 105 if (!f.open(QFile::WriteOnly))
106 106 qFatal("Failed to open %s for writing.", qPrintable(file));
107 107  
108   - foreach(const QString & line, lines) {
  108 + foreach (const QString & line, lines)
109 109 f.write((line+"\n").toLocal8Bit() );
110   - }
  110 +
111 111 f.close();
112 112 }
113 113  
... ... @@ -429,7 +429,7 @@ QString toString(const QVariantList &amp;variantList)
429 429 {
430 430 QStringList variants;
431 431  
432   - foreach(const QVariant &variant, variantList)
  432 + foreach (const QVariant &variant, variantList)
433 433 variants.append(toString(variant));
434 434  
435 435 if (!variants.isEmpty()) return "[" + variants.join(", ") + "]";
... ...
openbr/openbr_plugin.cpp
... ... @@ -205,7 +205,7 @@ QList&lt;QRectF&gt; File::namedRects() const
205 205 const QVariant &variant = m_metadata[key];
206 206 if (variant.canConvert<QRectF>())
207 207 rects.append(variant.value<QRectF>());
208   - else if(variant.canConvert<QList<QRectF> >()) {
  208 + else if (variant.canConvert<QList<QRectF> >()) {
209 209 QList<QRectF> list = variant.value<QList<QRectF> >();
210 210 for (int i=0;i < list.size();i++)
211 211 {
... ... @@ -1323,8 +1323,7 @@ QList&lt;Transform *&gt; Transform::getChildren() const
1323 1323  
1324 1324 TemplateEvent *Transform::getEvent(const QString &name)
1325 1325 {
1326   - foreach(Transform *child, getChildren())
1327   - {
  1326 + foreach (Transform *child, getChildren()) {
1328 1327 TemplateEvent *probe = child->getEvent(name);
1329 1328 if (probe)
1330 1329 return probe;
... ... @@ -1347,9 +1346,9 @@ void Transform::train(const TemplateList &amp;data)
1347 1346 void Transform::train(const QList<TemplateList> &data)
1348 1347 {
1349 1348 TemplateList combined;
1350   - foreach(const TemplateList &set, data) {
  1349 + foreach (const TemplateList &set, data)
1351 1350 combined.append(set);
1352   - }
  1351 +
1353 1352 train(combined);
1354 1353 }
1355 1354  
... ...
openbr/openbr_plugin.h
... ... @@ -494,7 +494,7 @@ struct TemplateList : public QList&lt;Template&gt;
494 494 int sum = 0;
495 495 QList<TemplateList> partitions; partitions.reserve(partitionSizes.size());
496 496  
497   - for(int i=0; i<partitionSizes.size(); i++) {
  497 + for (int i=0; i<partitionSizes.size(); i++) {
498 498 partitions.append(TemplateList());
499 499 sum+=partitionSizes[i];
500 500 }
... ...
openbr/plugins/format.cpp
... ... @@ -62,7 +62,7 @@ public:
62 62 }
63 63  
64 64 bool open = true;
65   - while(open) {
  65 + while (open) {
66 66 cv::Mat frame;
67 67 open = videoSource.read(frame);
68 68 if (!open) break;
... ...
openbr/plugins/gui.cpp
... ... @@ -261,7 +261,7 @@ public:
261 261 // rclick -- reset state if drawing, remove last rect if done
262 262 else if (mouseEvent->button() == Qt::RightButton && (!rects.isEmpty() || drawingRect))
263 263 {
264   - if(drawingRect)
  264 + if (drawingRect)
265 265 drawingRect = false;
266 266 else
267 267 {
... ... @@ -343,7 +343,7 @@ class PointMarkingWindow : public DisplayWindow
343 343  
344 344 QPainter painter(&pixmapBuffer);
345 345 painter.setBrush(Qt::red);
346   - foreach(const QPointF &point, points) painter.drawEllipse(point, 4, 4);
  346 + foreach (const QPointF &point, points) painter.drawEllipse(point, 4, 4);
347 347  
348 348 setPixmap(pixmapBuffer);
349 349  
... ... @@ -458,7 +458,7 @@ public slots:
458 458 wait.wait(&lock);
459 459  
460 460 QStringList values;
461   - for(int i = 0; i<fields.size(); i++) {
  461 + for (int i = 0; i<fields.size(); i++) {
462 462 values.append(fields.at(i)->text());
463 463 fields[i]->clear();
464 464 }
... ... @@ -482,7 +482,7 @@ private:
482 482 void createForm()
483 483 {
484 484 if (fields.size() != keys.size()) {
485   - foreach(const QString& label, keys) {
  485 + foreach (const QString& label, keys) {
486 486 QLineEdit *edit = new QLineEdit;
487 487 fields.append(edit);
488 488 QFormLayout *form = new QFormLayout;
... ... @@ -672,7 +672,7 @@ public:
672 672 return;
673 673  
674 674 for (int i = 0; i < dst.size(); i++) {
675   - foreach(const cv::Mat &m, dst[i]) {
  675 + foreach (const cv::Mat &m, dst[i]) {
676 676 qImageBuffer = toQImage(m);
677 677 displayBuffer->convertFromImage(qImageBuffer);
678 678  
... ... @@ -727,7 +727,7 @@ public:
727 727 return;
728 728  
729 729 for (int i = 0; i < dst.size(); i++) {
730   - foreach(const cv::Mat &m, dst[i]) {
  730 + foreach (const cv::Mat &m, dst[i]) {
731 731 qImageBuffer = toQImage(m);
732 732 displayBuffer->convertFromImage(qImageBuffer);
733 733  
... ... @@ -823,14 +823,14 @@ public:
823 823 if (src.empty()) return;
824 824  
825 825 for (int i = 0; i < dst.size(); i++) {
826   - foreach(const cv::Mat &m, dst[i]) {
  826 + foreach (const cv::Mat &m, dst[i]) {
827 827 qImageBuffer = toQImage(m);
828 828 displayBuffer->convertFromImage(qImageBuffer);
829 829  
830 830 emit updateImage(displayBuffer->copy(displayBuffer->rect()));
831 831  
832 832 QStringList metadata = gui->waitForButtonPress();
833   - for(int j = 0; j < keys.size(); j++) dst[i].file.set(keys[j],metadata[j]);
  833 + for (int j = 0; j < keys.size(); j++) dst[i].file.set(keys[j],metadata[j]);
834 834 }
835 835 }
836 836 }
... ... @@ -895,7 +895,7 @@ public:
895 895 return;
896 896  
897 897 for (int i = 0; i < dst.size(); i++) {
898   - foreach(const cv::Mat &m, dst[i]) {
  898 + foreach (const cv::Mat &m, dst[i]) {
899 899 qImageBuffer = toQImage(m);
900 900 displayBuffer->convertFromImage(qImageBuffer);
901 901  
... ...
openbr/plugins/meta.cpp
... ... @@ -667,7 +667,7 @@ public:
667 667  
668 668 QList<TemplateList> separated;
669 669 foreach (const TemplateList &list, data) {
670   - foreach(const Template &t, list) {
  670 + foreach (const Template &t, list) {
671 671 separated.append(TemplateList());
672 672 separated.last().append(t);
673 673 }
... ...
openbr/plugins/misc.cpp
... ... @@ -525,7 +525,7 @@ class IncrementalOutputTransform : public TimeVaryingTransform
525 525  
526 526 dst = src;
527 527 int idx =0;
528   - foreach(const Template &t, src) {
  528 + foreach (const Template &t, src) {
529 529 if (t.empty())
530 530 continue;
531 531  
... ... @@ -692,9 +692,8 @@ class OutputTransform : public TimeVaryingTransform
692 692 return;
693 693  
694 694 // we received a template, which is the next row/column in order
695   - foreach(const Template &t, dst) {
696   - for (int i=0; i < t.m().cols; i++)
697   - {
  695 + foreach (const Template &t, dst) {
  696 + for (int i=0; i < t.m().cols; i++) {
698 697 output->setRelative(t.m().at<float>(0, i), currentRow, currentCol);
699 698  
700 699 // row-major input
... ... @@ -718,21 +717,18 @@ class OutputTransform : public TimeVaryingTransform
718 717  
719 718 bool blockDone = false;
720 719 // In direct mode, we don't buffer rows
721   - if (!transposeMode)
722   - {
  720 + if (!transposeMode) {
723 721 currentBlockRow++;
724 722 blockDone = true;
725 723 }
726 724 // in transpose mode, we buffer 100 cols before writing the block
727   - else if (currentCol == bufferedSize)
728   - {
  725 + else if (currentCol == bufferedSize) {
729 726 currentBlockCol++;
730 727 blockDone = true;
731 728 }
732 729 else return;
733 730  
734   - if (blockDone)
735   - {
  731 + if (blockDone) {
736 732 // set the next block, only necessary if we haven't buffered the current item
737 733 output->setBlock(currentBlockRow, currentBlockCol);
738 734 currentRow = 0;
... ... @@ -761,15 +757,13 @@ class OutputTransform : public TimeVaryingTransform
761 757  
762 758 bufferedSize = 100;
763 759  
764   - if (transposeMode)
765   - {
  760 + if (transposeMode) {
766 761 // buffer 100 cols at a time
767 762 fragmentsPerRow = bufferedSize;
768 763 // a single col contains comparisons to all query files
769 764 fragmentsPerCol = queryFiles.size();
770 765 }
771   - else
772   - {
  766 + else {
773 767 // a single row contains comparisons to all target files
774 768 fragmentsPerRow = targetFiles.size();
775 769 // we output rows one at a time
... ... @@ -819,8 +813,7 @@ class FileExclusionTransform : public UntrainableMetaTransform
819 813  
820 814 void project(const TemplateList &src, TemplateList &dst) const
821 815 {
822   - foreach(const Template &srcTemp, src)
823   - {
  816 + foreach (const Template &srcTemp, src) {
824 817 if (!excluded.contains(srcTemp.file))
825 818 dst.append(srcTemp);
826 819 }
... ...
openbr/plugins/openbr_internal.h
... ... @@ -289,8 +289,7 @@ public:
289 289 if (output == NULL)
290 290 qFatal("Dynamic cast failed!");
291 291  
292   - foreach(Transform* t, transforms )
293   - {
  292 + foreach (Transform* t, transforms ) {
294 293 bool newItem = false;
295 294 Transform *maybe_copy = t->smartCopy(newItem);
296 295 if (newItem)
... ...
openbr/plugins/regions.cpp
... ... @@ -324,7 +324,7 @@ class RectFromPointsTransform : public UntrainableTransform
324 324  
325 325 QList<QPointF> points;
326 326  
327   - foreach(int index, indices) {
  327 + foreach (int index, indices) {
328 328 if (src.file.points().size() > index) {
329 329 if (src.file.points()[index].x() < minX) minX = src.file.points()[index].x();
330 330 if (src.file.points()[index].x() > maxX) maxX = src.file.points()[index].x();
... ...
openbr/plugins/stream.cpp
... ... @@ -1355,16 +1355,16 @@ public:
1355 1355  
1356 1356 // dst is set to all output received by the final stage, along
1357 1357 // with anything output via the calls to finalize.
1358   - foreach(const TemplateList &list, collector->sets) {
  1358 + foreach (const TemplateList &list, collector->sets)
1359 1359 dst.append(list);
1360   - }
  1360 +
1361 1361 collector->sets.clear();
1362 1362  
1363 1363 dst.append(final_output);
1364 1364  
1365   - foreach(ProcessingStage *stage, processingStages) {
  1365 + foreach (ProcessingStage *stage, processingStages)
1366 1366 stage->reset();
1367   - }
  1367 +
1368 1368 }
1369 1369  
1370 1370  
... ...
openbr/plugins/template.cpp
... ... @@ -19,9 +19,9 @@ class KeepMetadataTransform : public UntrainableMetadataTransform
19 19 void projectMetadata(const File &src, File &dst) const
20 20 {
21 21 dst = src;
22   - foreach(const QString& localKey, dst.localKeys()) {
23   - if (!keys.contains(localKey)) dst.remove(localKey);
24   - }
  22 + foreach (const QString& localKey, dst.localKeys())
  23 + if (!keys.contains(localKey))
  24 + dst.remove(localKey);
25 25 }
26 26 };
27 27  
... ...