VariableManager: Do not try to expand Prefixes

Resolving "Prefix:<value>" does not make any sense, so let's not
do that.

Task-number: QTCREATORBUG-15072
Change-Id: Ia9741f9b48d269a7be31163ad73c3bc232856419
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-09-17 13:48:02 +02:00
parent 39e8a3abf3
commit 3f1b622fb7
3 changed files with 20 additions and 5 deletions

View File

@@ -302,6 +302,14 @@ QString MacroExpander::expandProcessArgs(const QString &argsWithVariables) const
return QtcProcess::expandMacros(argsWithVariables, d);
}
static QByteArray fullPrefix(const QByteArray &prefix)
{
QByteArray result = prefix;
if (!result.endsWith(':'))
result.append(':');
return result;
}
/*!
* Makes the given string-valued \a prefix known to the variable manager,
* together with a localized \a description.
@@ -314,9 +322,7 @@ QString MacroExpander::expandProcessArgs(const QString &argsWithVariables) const
void MacroExpander::registerPrefix(const QByteArray &prefix, const QString &description,
const MacroExpander::PrefixFunction &value)
{
QByteArray tmp = prefix;
if (!tmp.endsWith(':'))
tmp.append(':');
QByteArray tmp = fullPrefix(prefix);
d->m_descriptions.insert(tmp + "<value>", description);
d->m_prefixMap.insert(tmp, value);
}
@@ -430,6 +436,11 @@ QString MacroExpander::variableDescription(const QByteArray &variable) const
return d->m_descriptions.value(variable);
}
bool MacroExpander::isPrefixVariable(const QByteArray &variable) const
{
return d->m_prefixMap.contains(fullPrefix(variable));
}
MacroExpanderProviders MacroExpander::subProviders() const
{
return d->m_subProviders;