Commit fd2c2df8 authored by Tobias Hunger's avatar Tobias Hunger

SDKtool: Rename findValues method to findValue

It only searches for one value.

Change-Id: If780de3a919c41a03c9c0a978688fd1ea0411eb9
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 0b939667
......@@ -174,7 +174,7 @@ QVariantMap AddDebuggerOperation::addDebugger(const QVariantMap &map,
const QStringList &abis, const KeyValuePairList &extra)
{
// Sanity check: Make sure autodetection source is not in use already:
QStringList valueKeys = FindValueOperation::findValues(map, QVariant(id));
QStringList valueKeys = FindValueOperation::findValue(map, QVariant(id));
bool hasId = false;
foreach (const QString &k, valueKeys) {
if (k.endsWith(QString(QLatin1Char('/')) + QLatin1String(ID))) {
......
......@@ -398,7 +398,7 @@ QVariantMap AddKitOperation::addKit(const QVariantMap &map,
const KeyValuePairList &extra)
{
// Sanity check: Make sure autodetection source is not in use already:
QStringList valueKeys = FindValueOperation::findValues(map, QVariant(id));
QStringList valueKeys = FindValueOperation::findValue(map, QVariant(id));
bool hasId = false;
foreach (const QString &k, valueKeys) {
if (k.endsWith(QString(QLatin1Char('/')) + QLatin1String(ID))) {
......
......@@ -256,7 +256,7 @@ QVariantMap AddQtOperation::addQt(const QVariantMap &map,
sdkId = QString::fromLatin1("SDK.") + id;
// Sanity check: Make sure autodetection source is not in use already:
QStringList valueKeys = FindValueOperation::findValues(map, sdkId);
QStringList valueKeys = FindValueOperation::findValue(map, sdkId);
bool hasId = false;
foreach (const QString &k, valueKeys) {
if (k.endsWith(QString(QLatin1Char('/')) + QLatin1String(AUTODETECTION_SOURCE))) {
......
......@@ -225,7 +225,7 @@ QVariantMap AddToolChainOperation::addToolChain(const QVariantMap &map,
const QString &supportedAbis, const KeyValuePairList &extra)
{
// Sanity check: Does the Id already exist?
QStringList valueKeys = FindValueOperation::findValues(map, id);
QStringList valueKeys = FindValueOperation::findValue(map, id);
bool hasId = false;
foreach (const QString &k, valueKeys) {
if (k.endsWith(QString(QLatin1Char('/')) + QLatin1String(ID))) {
......
......@@ -82,7 +82,7 @@ int FindValueOperation::execute() const
QVariantMap map = load(m_file);
foreach (const QVariant &v, m_values) {
const QStringList result = findValues(map, v);
const QStringList result = findValue(map, v);
foreach (const QString &r, result)
std::cout << qPrintable(r) << std::endl;
}
......@@ -120,22 +120,22 @@ bool FindValueOperation::test() const
testMap.insert(QLatin1String("aList"), list1);
QStringList result;
result = findValues(testMap, QVariant(23));
result = findValue(testMap, QVariant(23));
if (result.count() != 1
|| !result.contains(QLatin1String("testint")))
return false;
result = findValues(testMap, QVariant(53));
result = findValue(testMap, QVariant(53));
if (result.count() != 2
|| !result.contains(QLatin1String("subkeys/subsubkeys/testint2"))
|| !result.contains(QLatin1String("subkeys/otherint")))
return false;
result = findValues(testMap, QVariant(23456));
result = findValue(testMap, QVariant(23456));
if (!result.isEmpty())
return false;
result = findValues(testMap, QVariant(QString::fromLatin1("FindInList")));
result = findValue(testMap, QVariant(QString::fromLatin1("FindInList")));
if (result.count() != 1
|| !result.contains(QLatin1String("aList[2][1]/findMe")))
return false;
......@@ -144,7 +144,7 @@ bool FindValueOperation::test() const
}
#endif
QStringList FindValueOperation::findValues(const QVariant &in, const QVariant &value,
QStringList FindValueOperation::findValue(const QVariant &in, const QVariant &value,
const QString &prefix)
{
QStringList result;
......@@ -157,13 +157,13 @@ QStringList FindValueOperation::findValues(const QVariant &in, const QVariant &v
if (!pfx.isEmpty())
pfx.append(QLatin1Char('/'));
pfx.append(i.key());
result.append(findValues(i.value(), value, pfx));
result.append(findValue(i.value(), value, pfx));
}
} else if (in.type() == QVariant::List) {
QVariantList list = in.toList();
for (int pos = 0; pos < list.count(); ++pos) {
QString pfx = prefix + QLatin1Char('[') + QString::number(pos) + QLatin1String("]");
result.append(findValues(list.at(pos), value, pfx));
result.append(findValue(list.at(pos), value, pfx));
}
}
return result;
......
......@@ -47,7 +47,7 @@ public:
bool test() const;
#endif
static QStringList findValues(const QVariant &in, const QVariant &value,
static QStringList findValue(const QVariant &in, const QVariant &value,
const QString &prefix = QString());
private:
......
Markdown is supported
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