summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolseditorsupport.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-08-19 15:47:51 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2013-09-11 09:43:14 +0200
commitf7c68f6baf104729e8d2fb3a0693b3c59928f8d3 (patch)
treefc0b7227fb28425b65f194d1f6d58bb4d5f53299 /src/plugins/cpptools/cpptoolseditorsupport.cpp
parenteebb1dfcf4d0d4a391a77ab9e095188f63b616e4 (diff)
downloadqt-creator-f7c68f6baf104729e8d2fb3a0693b3c59928f8d3.tar.gz
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>
Diffstat (limited to 'src/plugins/cpptools/cpptoolseditorsupport.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index 4c77287ac2..04f5e26902 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -166,12 +166,12 @@ QString CppEditorSupport::fileName() const
return m_textEditor->document()->filePath();
}
-QString CppEditorSupport::contents() const
+QByteArray CppEditorSupport::contents() const
{
const int editorRev = editorRevision();
if (m_cachedContentsEditorRevision != editorRev && !m_fileIsBeingReloaded) {
m_cachedContentsEditorRevision = editorRev;
- m_cachedContents = m_textEditor->textDocument()->contents();
+ m_cachedContents = m_textEditor->textDocument()->contents().toUtf8();
}
return m_cachedContents;
@@ -430,7 +430,7 @@ SemanticInfo::Source CppEditorSupport::currentSource(bool force)
const Snapshot snapshot = m_modelManager->snapshot();
- QString code;
+ QByteArray code;
if (force || m_lastSemanticInfo.revision != editorRevision())
code = contents(); // get the source code only when needed.