SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
targetsheet.cpp
Go to the documentation of this file.
1// SedSAT3 – Sediment Source Assessment Tool, version 3
2// U.S. Geological Survey. See LICENSE.md and DISCLAIMER.md in the repository root.
3
4#include "targetsheet.h"
5
6int GuessTargetSheet(const QStringList& sheets)
7{
8 // The names that say "these are the target samples". Matched as
9 // substrings so "Target samples" and "Sink_2013" are recognised too.
10 static const QStringList kTargetWords = { "target", "sink", "mixture" };
11
12 int found = -1;
13 for (int i = 0; i < sheets.count(); ++i)
14 {
15 const QString name = sheets[i].trimmed().toLower();
16 bool matches = false;
17 for (const QString& word : kTargetWords)
18 matches = matches || name.contains(word);
19
20 if (!matches)
21 continue;
22
23 if (found >= 0)
24 return -1; // More than one candidate: let the user choose
25
26 found = i;
27 }
28
29 return found;
30}
int GuessTargetSheet(const QStringList &sheets)
Index of the sheet whose name says it holds the target samples.
Which sheet of a workbook holds the target samples.