forked from qt-creator/qt-creator
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:
@@ -736,7 +736,8 @@ void Snapshot::insert(Document::Ptr doc)
|
||||
_documents.insert(doc->fileName(), doc);
|
||||
}
|
||||
|
||||
Document::Ptr Snapshot::preprocessedDocument(const QString &source, const QString &fileName) const
|
||||
Document::Ptr Snapshot::preprocessedDocument(const QByteArray &source,
|
||||
const QString &fileName) const
|
||||
{
|
||||
Document::Ptr newDoc = Document::create(fileName);
|
||||
if (Document::Ptr thisDocument = document(fileName)) {
|
||||
|
||||
@@ -398,7 +398,7 @@ public:
|
||||
|
||||
Snapshot simplified(Document::Ptr doc) const;
|
||||
|
||||
Document::Ptr preprocessedDocument(const QString &source,
|
||||
Document::Ptr preprocessedDocument(const QByteArray &source,
|
||||
const QString &fileName) const;
|
||||
|
||||
Document::Ptr documentFromSource(const QByteArray &preprocessedDocument,
|
||||
|
||||
@@ -41,7 +41,7 @@ FastPreprocessor::FastPreprocessor(const Snapshot &snapshot)
|
||||
, _preproc(this, &_env)
|
||||
{ }
|
||||
|
||||
QByteArray FastPreprocessor::run(Document::Ptr newDoc, const QString &source)
|
||||
QByteArray FastPreprocessor::run(Document::Ptr newDoc, const QByteArray &source)
|
||||
{
|
||||
std::swap(newDoc, _currentDoc);
|
||||
const QString fileName = _currentDoc->fileName();
|
||||
|
||||
@@ -54,7 +54,7 @@ class CPLUSPLUS_EXPORT FastPreprocessor: public Client
|
||||
public:
|
||||
FastPreprocessor(const Snapshot &snapshot);
|
||||
|
||||
QByteArray run(Document::Ptr newDoc, const QString &source);
|
||||
QByteArray run(Document::Ptr newDoc, const QByteArray &source);
|
||||
|
||||
// CPlusPlus::Client
|
||||
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode);
|
||||
|
||||
Reference in New Issue
Block a user