ClassView: Use only const pointers to ParserTreeItems

There is no need to use non-const pointers anymore. This also
ensures, that after generating the tree data in the non-gui
thread no-one modifies already created items.

Task-number: QTCREATORBUG-25317
Change-Id: I91f63da8f57ae9798587265adc029ebd0c68504e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2021-02-16 16:04:50 +01:00
parent d4fe3fdb15
commit 8c5dc305ae
4 changed files with 35 additions and 36 deletions

View File

@@ -43,21 +43,20 @@ class ParserTreeItemPrivate;
class ParserTreeItem
{
public:
using Ptr = QSharedPointer<ParserTreeItem>;
using ConstPtr = QSharedPointer<const ParserTreeItem>;
public:
ParserTreeItem();
ParserTreeItem(const Utils::FilePath &projectFilePath);
ParserTreeItem(const QHash<SymbolInformation, Ptr> &children);
ParserTreeItem(const QHash<SymbolInformation, ConstPtr> &children);
~ParserTreeItem();
static Ptr parseDocument(const CPlusPlus::Document::Ptr &doc);
static Ptr mergeTrees(const Utils::FilePath &projectFilePath, const QList<ConstPtr> &docTrees);
static ConstPtr parseDocument(const CPlusPlus::Document::Ptr &doc);
static ConstPtr mergeTrees(const Utils::FilePath &projectFilePath, const QList<ConstPtr> &docTrees);
Utils::FilePath projectFilePath() const;
QSet<SymbolLocation> symbolLocations() const;
Ptr child(const SymbolInformation &inf) const;
ConstPtr child(const SymbolInformation &inf) const;
int childCount() const;
// Make sure that below two methods are called only from the GUI thread