1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2010 Denis Mingulov.
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef CLASSVIEWPARSERTREEITEM_H
35 #define CLASSVIEWPARSERTREEITEM_H
37 #include "classviewsymbollocation.h"
38 #include "classviewsymbolinformation.h"
40 #include <QtCore/QSharedPointer>
41 #include <QtCore/QScopedPointer>
43 QT_FORWARD_DECLARE_CLASS(QStandardItem)
50 \brief Item for the internal Class View Tree
52 Item for Class View Tree.
53 Not virtual - to speed up its work.
59 typedef QSharedPointer<ParserTreeItem> Ptr;
60 typedef QSharedPointer<const ParserTreeItem> ConstPtr;
67 \brief Copy content of \a from item with children to this one.
68 \param from 'From' item
70 void copyTree(const ParserTreeItem::ConstPtr &from);
73 \brief Copy of \a from item to this one.
74 \param from 'From' item
76 void copy(const ParserTreeItem::ConstPtr &from);
79 \brief Add information about symbol location
80 \param location Filled \a SymbolLocation struct with a correct information
81 \sa SymbolLocation, removeSymbolLocation, symbolLocations
83 void addSymbolLocation(const SymbolLocation &location);
86 \brief Add information about symbol locations
87 \param locations Filled \a SymbolLocation struct with a correct information
88 \sa SymbolLocation, removeSymbolLocation, symbolLocations
90 void addSymbolLocation(const QSet<SymbolLocation> &locations);
93 \brief Remove information about symbol location
94 \param location Filled \a SymbolLocation struct with a correct information
95 \sa SymbolLocation, addSymbolLocation, symbolLocations
97 void removeSymbolLocation(const SymbolLocation &location);
100 \brief Remove information about symbol locations
101 \param locations Filled \a SymbolLocation struct with a correct information
102 \sa SymbolLocation, addSymbolLocation, symbolLocations
104 void removeSymbolLocations(const QSet<SymbolLocation> &locations);
107 \brief Get information about symbol positions
108 \sa SymbolLocation, addSymbolLocation, removeSymbolLocation
110 QSet<SymbolLocation> symbolLocations() const;
114 \param item Child item
115 \param inf Symbol information
117 void appendChild(const ParserTreeItem::Ptr &item, const SymbolInformation &inf);
121 \param inf SymbolInformation which has to be removed
123 void removeChild(const SymbolInformation &inf);
127 \param inf Symbol information about needed child
130 ParserTreeItem::Ptr child(const SymbolInformation &inf) const;
133 \brief How many children
134 \return Amount of chilren
136 int childCount() const;
139 \brief Append this item to the \a QStandardIten item
140 \param item QStandardItem
141 \param recursive Do it recursively for the tree items or not (might be needed for
142 the lazy data population
145 void convertTo(QStandardItem *item, bool recursive = true) const;
147 // additional properties
151 //! Set an icon for this tree node
152 void setIcon(const QIcon &icon);
155 \brief Add an internal state with \a target.
156 \param target Item which contains the correct current state
158 void add(const ParserTreeItem::ConstPtr &target);
161 \brief Subtract an internal state with \a target.
162 \param target Item which contains the subtrahend
164 void subtract(const ParserTreeItem::ConstPtr &target);
167 \brief Lazy data population for a \a QStandardItemModel
168 \param item Item which has to be checked
170 bool canFetchMore(QStandardItem *item) const;
173 \brief Lazy data population for a \a QStandardItemModel
174 \param item Item which will be populated (if needed)
176 void fetchMore(QStandardItem *item) const;
181 void debugDump(int ident = 0) const;
184 ParserTreeItem &operator=(const ParserTreeItem &other);
187 //! Private class data pointer
188 QScopedPointer<struct ParserTreeItemPrivate> d_ptr;
191 } // namespace Internal
192 } // namespace ClassView
194 #endif // CLASSVIEWPARSERTREEITEM_H