C++: Accept UTF-8 byte arrays in type of expression

The model uses UTF-8 internally and it makes more sense to only
convert when necessary.

A following commit will rename the source/setSource methods in
document for more clarity too.

Change-Id: I960ea0754efabd1436ad4b4299a57faeb65a8bee
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Leandro Melo
2012-01-12 17:35:37 +01:00
parent edcb065edb
commit fd179ed951
11 changed files with 51 additions and 51 deletions

View File

@@ -1051,7 +1051,7 @@ bool CppCompletionAssistProcessor::tryObjCCompletion()
if (!scope)
return false;
const QList<LookupItem> items = (*m_model->m_typeOfExpression)(expr, scope);
const QList<LookupItem> items = (*m_model->m_typeOfExpression)(expr.toUtf8(), scope);
LookupContext lookupContext(thisDocument, m_interface->snapshot());
foreach (const LookupItem &item, items) {
@@ -1254,7 +1254,7 @@ int CppCompletionAssistProcessor::startCompletionInternal(const QString fileName
if (expression.isEmpty()) {
if (m_model->m_completionOperator == T_EOF_SYMBOL || m_model->m_completionOperator == T_COLON_COLON) {
(void) (*m_model->m_typeOfExpression)(expression, scope);
(void) (*m_model->m_typeOfExpression)(expression.toUtf8(), scope);
globalCompletion(scope);
if (m_completions.isEmpty())
return -1;
@@ -1267,14 +1267,15 @@ int CppCompletionAssistProcessor::startCompletionInternal(const QString fileName
}
}
QByteArray utf8Exp = expression.toUtf8();
QList<LookupItem> results =
(*m_model->m_typeOfExpression)(expression, scope, TypeOfExpression::Preprocess);
(*m_model->m_typeOfExpression)(utf8Exp, scope, TypeOfExpression::Preprocess);
if (results.isEmpty()) {
if (m_model->m_completionOperator == T_SIGNAL || m_model->m_completionOperator == T_SLOT) {
if (! (expression.isEmpty() || expression == QLatin1String("this"))) {
expression = QLatin1String("this");
results = (*m_model->m_typeOfExpression)(expression, scope);
results = (*m_model->m_typeOfExpression)(utf8Exp, scope);
}
if (results.isEmpty())
@@ -1295,7 +1296,7 @@ int CppCompletionAssistProcessor::startCompletionInternal(const QString fileName
// Resolve the type of this expression
const QList<LookupItem> results =
(*m_model->m_typeOfExpression)(baseExpression, scope,
(*m_model->m_typeOfExpression)(baseExpression.toUtf8(), scope,
TypeOfExpression::Preprocess);
// If it's a class, add completions for the constructors