C++: change working-copy to work on UTF-8 encoded QByteArrays.

These not only take less space than UTF-16 encoded QStrings, but due to
the caching in the CppEditorSupport also take less time to build.

This patch also fixes a number of possible encoding issues, where files
and constant strings were (falsely) assumed to be UTF-8.

Change-Id: Ib6f91c9a94ebed5b5dfbd4eb2998825c62c72784
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Erik Verbruggen
2013-08-19 15:47:51 +02:00
parent eebb1dfcf4
commit f7c68f6baf
24 changed files with 118 additions and 67 deletions

View File

@@ -541,13 +541,13 @@ CppModelManager::WorkingCopy CppModelManager::buildWorkingCopyList()
QSetIterator<AbstractEditorSupport *> it(m_extraEditorSupports);
while (it.hasNext()) {
AbstractEditorSupport *es = it.next();
workingCopy.insert(es->fileName(), QString::fromUtf8(es->contents()));
workingCopy.insert(es->fileName(), es->contents());
}
// Add the project configuration file
QByteArray conf(pp_configuration);
QByteArray conf = QByteArray::fromRawData(pp_configuration, qstrlen(pp_configuration));
conf += definedMacros();
workingCopy.insert(configurationFileName(), QString::fromLocal8Bit(conf));
workingCopy.insert(configurationFileName(), conf);
return workingCopy;
}