summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanagerinterface.h
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/cppmodelmanagerinterface.h
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/cppmodelmanagerinterface.h')
-rw-r--r--src/plugins/cpptools/cppmodelmanagerinterface.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h
index 33954d47ea..4bcf1c6059 100644
--- a/src/plugins/cpptools/cppmodelmanagerinterface.h
+++ b/src/plugins/cpptools/cppmodelmanagerinterface.h
@@ -176,29 +176,38 @@ public:
QByteArray m_defines;
};
+ /// The working-copy stores all files that are stored on disk in their current state.
+ ///
+ /// So, currently the working copy holds:
+ /// - unsaved content of editors
+ /// - uic-ed UI files (through \c AbstractEditorSupport)
+ /// - the preprocessor configuration
+ ///
+ /// Contents are keyed on filename, and hold the revision in the editor and the editor's
+ /// contents encoded as UTF-8.
class CPPTOOLS_EXPORT WorkingCopy
{
public:
- void insert(const QString &fileName, const QString &source, unsigned revision = 0)
+ void insert(const QString &fileName, const QByteArray &source, unsigned revision = 0)
{ _elements.insert(fileName, qMakePair(source, revision)); }
bool contains(const QString &fileName) const
{ return _elements.contains(fileName); }
- QString source(const QString &fileName) const
+ QByteArray source(const QString &fileName) const
{ return _elements.value(fileName).first; }
- QPair<QString, unsigned> get(const QString &fileName) const
+ QPair<QByteArray, unsigned> get(const QString &fileName) const
{ return _elements.value(fileName); }
- QHashIterator<QString, QPair<QString, unsigned> > iterator() const
- { return QHashIterator<QString, QPair<QString, unsigned> >(_elements); }
+ QHashIterator<QString, QPair<QByteArray, unsigned> > iterator() const
+ { return QHashIterator<QString, QPair<QByteArray, unsigned> >(_elements); }
int size() const
{ return _elements.size(); }
private:
- typedef QHash<QString, QPair<QString, unsigned> > Table;
+ typedef QHash<QString, QPair<QByteArray, unsigned> > Table;
Table _elements;
};