• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevelop/kdevplatform/language/classmodel

  • extragear
  • kdevelop
  • kdevelop
  • kdevplatform
  • language
  • classmodel
classmodelnode.cpp
Go to the documentation of this file.
1 /*
2  * KDevelop Class Browser
3  *
4  * Copyright 2007-2009 Hamish Rodda <[email protected]>
5  * Copyright 2009 Lior Mualem <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Library General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public
18  * License along with this program; if not, write to the
19  * Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #include "classmodelnode.h"
24 
25 #include <typeinfo>
26 #include <KLocalizedString>
27 
28 #include "../duchain/duchainlock.h"
29 #include "../duchain/duchain.h"
30 #include "../duchain/persistentsymboltable.h"
31 #include "../duchain/duchainutils.h"
32 #include "../duchain/classdeclaration.h"
33 #include "../duchain/classfunctiondeclaration.h"
34 #include "../duchain/types/functiontype.h"
35 #include "../duchain/types/enumerationtype.h"
36 
37 #include <debug.h>
38 
39 using namespace KDevelop;
40 using namespace ClassModelNodes;
41 
42 IdentifierNode::IdentifierNode(KDevelop::Declaration* a_decl,
43  NodesModelInterface* a_model,
44  const QString& a_displayName)
45  : DynamicNode(a_displayName.isEmpty() ? a_decl->identifier().toString() : a_displayName, a_model)
46  , m_identifier(a_decl->qualifiedIdentifier())
47  , m_indexedDeclaration(a_decl)
48  , m_cachedDeclaration(a_decl)
49 {
50 }
51 
52 Declaration* IdentifierNode::declaration()
53 {
54  if (!m_cachedDeclaration)
55  m_cachedDeclaration = m_indexedDeclaration.declaration();
56 
57  return m_cachedDeclaration.data();
58 }
59 
60 bool IdentifierNode::getIcon(QIcon& a_resultIcon)
61 {
62  DUChainReadLocker readLock(DUChain::lock());
63 
64  Declaration* decl = declaration();
65  if (decl)
66  a_resultIcon = DUChainUtils::iconForDeclaration(decl);
67 
68  return !a_resultIcon.isNull();
69 }
70 
73 
74 EnumNode::EnumNode(KDevelop::Declaration* a_decl, NodesModelInterface* a_model)
75  : IdentifierNode(a_decl, a_model)
76 {
77  // Set display name for anonymous enums
78  if (m_displayName.isEmpty())
79  m_displayName = QStringLiteral("*Anonymous*");
80 }
81 
82 bool EnumNode::getIcon(QIcon& a_resultIcon)
83 {
84  DUChainReadLocker readLock(DUChain::lock());
85 
86  auto* decl = dynamic_cast<ClassMemberDeclaration*>(declaration());
87  if (decl == nullptr) {
88  a_resultIcon = QIcon::fromTheme(QStringLiteral("enum"));
89  } else
90  {
91  if (decl->accessPolicy() == Declaration::Protected) {
92  a_resultIcon = QIcon::fromTheme(QStringLiteral("protected_enum"));
93  } else if (decl->accessPolicy() == Declaration::Private) {
94  a_resultIcon = QIcon::fromTheme(QStringLiteral("private_enum"));
95  } else
96  {
97  a_resultIcon = QIcon::fromTheme(QStringLiteral("enum"));
98  }
99  }
100 
101  return true;
102 }
103 
104 void EnumNode::populateNode()
105 {
106  DUChainReadLocker readLock(DUChain::lock());
107 
108  Declaration* decl = declaration();
109 
110  if (decl->internalContext()) {
111  const auto localDeclarations = decl->internalContext()->localDeclarations();
112  for (Declaration* enumDecl : localDeclarations) {
113  addNode(new EnumNode(enumDecl, m_model));
114  }
115  }
116 }
117 
120 
121 ClassNode::ClassNode(Declaration* a_decl, NodesModelInterface* a_model)
122  : IdentifierNode(a_decl, a_model)
123 {
124 }
125 
126 ClassNode::~ClassNode()
127 {
128  if (!m_cachedUrl.isEmpty()) {
129  ClassModelNodesController::self().unregisterForChanges(m_cachedUrl, this);
130  m_cachedUrl = IndexedString();
131  }
132 }
133 
134 void ClassNode::populateNode()
135 {
136  DUChainReadLocker readLock(DUChain::lock());
137 
138  if (m_model->features().testFlag(NodesModelInterface::ClassInternals)) {
139  if (updateClassDeclarations()) {
140  m_cachedUrl = declaration()->url();
141  ClassModelNodesController::self().registerForChanges(m_cachedUrl, this);
142  }
143  }
144 
145  // Add special folders
146  if (m_model->features().testFlag(NodesModelInterface::BaseAndDerivedClasses))
147  addBaseAndDerived();
148 }
149 
150 template <> inline bool qMapLessThanKey(const IndexedIdentifier& key1, const IndexedIdentifier& key2)
151 {
152  return key1.index() < key2.index();
153 }
154 
155 bool ClassNode::updateClassDeclarations()
156 {
157  bool hadChanges = false;
158  SubIdentifiersMap existingIdentifiers = m_subIdentifiers;
159 
160  auto* klass = dynamic_cast<ClassDeclaration*>(declaration());
161 
162  if (klass) {
163  const auto localDeclarations = klass->internalContext()->localDeclarations();
164  for (Declaration* decl : localDeclarations) {
165  // Ignore forward declarations.
166  if (decl->isForwardDeclaration())
167  continue;
168 
169  // Don't add existing declarations.
170  const auto identifierIt = existingIdentifiers.find(decl->ownIndex());
171  if (identifierIt != existingIdentifiers.end()) {
172  existingIdentifiers.erase(identifierIt);
173  continue;
174  }
175 
176  Node* newNode = nullptr;
177 
178  if (EnumerationType::Ptr enumType = decl->type<EnumerationType>())
179  newNode = new EnumNode(decl, m_model);
180  else if (decl->isFunctionDeclaration())
181  newNode = new FunctionNode(decl, m_model);
182  else if (auto* classDecl = dynamic_cast<ClassDeclaration*>(decl))
183  newNode = new ClassNode(classDecl, m_model);
184  else if (auto* memDecl = dynamic_cast<ClassMemberDeclaration*>(decl))
185  newNode = new ClassMemberNode(memDecl, m_model);
186  else
187  {
188  // Debug - for reference.
189  qCDebug(LANGUAGE) << "class: " << klass->toString() << "name: " << decl->toString() <<
190  " - unknown declaration type: " << typeid(*decl).name();
191  }
192 
193  if (newNode) {
194  addNode(newNode);
195 
196  // Also remember the identifier.
197  m_subIdentifiers.insert(decl->ownIndex(), newNode);
198 
199  hadChanges = true;
200  }
201  }
202  }
203 
204  // Remove old existing identifiers
205  for (SubIdentifiersMap::iterator iter = existingIdentifiers.begin();
206  iter != existingIdentifiers.end();
207  ++iter) {
208  iter.value()->removeSelf();
209  m_subIdentifiers.remove(iter.key());
210  hadChanges = true;
211  }
212 
213  return hadChanges;
214 }
215 
216 bool ClassNode::addBaseAndDerived()
217 {
218  bool added = false;
219 
220  auto* baseClassesNode = new BaseClassesFolderNode(m_model);
221  addNode(baseClassesNode);
222  if (!baseClassesNode->hasChildren())
223  removeNode(baseClassesNode);
224  else
225  added = true;
226 
227  auto* derivedClassesNode = new DerivedClassesFolderNode(m_model);
228  addNode(derivedClassesNode);
229  if (!derivedClassesNode->hasChildren())
230  removeNode(derivedClassesNode);
231  else
232  added = true;
233 
234  return added;
235 }
236 
237 void ClassNode::nodeCleared()
238 {
239  if (!m_cachedUrl.isEmpty()) {
240  ClassModelNodesController::self().unregisterForChanges(m_cachedUrl, this);
241  m_cachedUrl = IndexedString();
242  }
243 
244  m_subIdentifiers.clear();
245 }
246 
247 void ClassModelNodes::ClassNode::documentChanged(const KDevelop::IndexedString&)
248 {
249  DUChainReadLocker readLock(DUChain::lock());
250 
251  if (updateClassDeclarations())
252  recursiveSort();
253 }
254 
255 ClassNode* ClassNode::findSubClass(const KDevelop::IndexedQualifiedIdentifier& a_id)
256 {
257  // Make sure we have sub nodes.
258  performPopulateNode();
259 
262  for (Node* item : qAsConst(m_subIdentifiers)) {
263  auto* classNode = dynamic_cast<ClassNode*>(item);
264  if (classNode == nullptr)
265  continue;
266 
267  if (classNode->identifier() == a_id)
268  return classNode;
269  }
270 
271  return nullptr;
272 }
273 
276 
277 FunctionNode::FunctionNode(Declaration* a_decl, NodesModelInterface* a_model)
278  : IdentifierNode(a_decl, a_model)
279 {
280  // Append the argument signature to the identifier's name (which is what the displayName is.
281  if (FunctionType::Ptr type = a_decl->type<FunctionType>())
282  m_displayName += type->partToString(FunctionType::SignatureArguments);
283 
284  // Add special values for ctor / dtor to sort first
285  auto* classmember = dynamic_cast<ClassFunctionDeclaration*>(a_decl);
286  if (classmember) {
287  if (classmember->isConstructor() || classmember->isDestructor())
288  m_sortableString = QLatin1Char('0') + m_displayName;
289  else
290  m_sortableString = QLatin1Char('1') + m_displayName;
291  } else {
292  m_sortableString = m_displayName;
293  }
294 }
295 
298 
299 ClassMemberNode::ClassMemberNode(KDevelop::ClassMemberDeclaration* a_decl, NodesModelInterface* a_model)
300  : IdentifierNode(a_decl, a_model)
301 {
302 }
303 
304 bool ClassMemberNode::getIcon(QIcon& a_resultIcon)
305 {
306  DUChainReadLocker readLock(DUChain::lock());
307 
308  auto* decl = dynamic_cast<ClassMemberDeclaration*>(declaration());
309  if (decl == nullptr)
310  return false;
311 
312  if (decl->isTypeAlias()) {
313  a_resultIcon = QIcon::fromTheme(QStringLiteral("typedef"));
314  } else if (decl->accessPolicy() == Declaration::Protected) {
315  a_resultIcon = QIcon::fromTheme(QStringLiteral("protected_field"));
316  } else if (decl->accessPolicy() == Declaration::Private) {
317  a_resultIcon = QIcon::fromTheme(QStringLiteral("private_field"));
318  } else
319  {
320  a_resultIcon = QIcon::fromTheme(QStringLiteral("field"));
321  }
322 
323  return true;
324 }
325 
328 
329 DynamicFolderNode::DynamicFolderNode(const QString& a_displayName, NodesModelInterface* a_model)
330  : DynamicNode(a_displayName, a_model)
331 {
332 }
333 
334 bool DynamicFolderNode::getIcon(QIcon& a_resultIcon)
335 {
336  a_resultIcon = QIcon::fromTheme(QStringLiteral("folder"));
337  return true;
338 }
339 
342 
343 FolderNode::FolderNode(const QString& a_displayName, NodesModelInterface* a_model)
344  : Node(a_displayName, a_model)
345 {
346 }
347 
348 bool FolderNode::getIcon(QIcon& a_resultIcon)
349 {
350  a_resultIcon = QIcon::fromTheme(QStringLiteral("folder"));
351  return true;
352 }
353 
356 
357 BaseClassesFolderNode::BaseClassesFolderNode(NodesModelInterface* a_model)
358  : DynamicFolderNode(i18n("Base classes"), a_model)
359 {
360 }
361 
362 void BaseClassesFolderNode::populateNode()
363 {
364  DUChainReadLocker readLock(DUChain::lock());
365 
366  auto* klass = dynamic_cast<ClassDeclaration*>(static_cast<ClassNode*>(parent())->declaration());
367  if (klass) {
368  // I use the imports instead of the baseClasses in the ClassDeclaration because I need
369  // to get to the base class identifier which is not directly accessible through the
370  // baseClasses function.
371  const auto imports = klass->internalContext()->importedParentContexts();
372  for (const DUContext::Import& import : imports) {
373  DUContext* baseContext = import.context(klass->topContext());
374  if (baseContext && baseContext->type() == DUContext::Class) {
375  Declaration* baseClassDeclaration = baseContext->owner();
376  if (baseClassDeclaration) {
377  // Add the base class.
378  addNode(new ClassNode(baseClassDeclaration, m_model));
379  }
380  }
381  }
382  }
383 }
384 
387 
388 DerivedClassesFolderNode::DerivedClassesFolderNode(NodesModelInterface* a_model)
389  : DynamicFolderNode(i18n("Derived classes"), a_model)
390 {
391 }
392 
393 void DerivedClassesFolderNode::populateNode()
394 {
395  DUChainReadLocker readLock(DUChain::lock());
396 
397  auto* klass = dynamic_cast<ClassDeclaration*>(static_cast<ClassNode*>(parent())->declaration());
398  if (klass) {
399  uint steps = 10000;
400  const QList<Declaration*> inheriters = DUChainUtils::inheriters(klass, steps, true);
401 
402  for (Declaration* decl : inheriters) {
403  addNode(new ClassNode(decl, m_model));
404  }
405  }
406 }
407 
410 
411 Node::Node(const QString& a_displayName, NodesModelInterface* a_model)
412  : m_parentNode(nullptr)
413  , m_displayName(a_displayName)
414  , m_model(a_model)
415 {
416 }
417 
418 Node::~Node()
419 {
420  // Notify the model about the removal of this nodes' children.
421  if (!m_children.empty() && m_model) {
422  m_model->nodesAboutToBeRemoved(this, 0, m_children.size() - 1);
423  clear();
424  m_model->nodesRemoved(this);
425  }
426 }
427 
428 void Node::clear()
429 {
430  qDeleteAll(m_children);
431  m_children.clear();
432 }
433 
434 void Node::addNode(Node* a_child)
435 {
438 // m_model->nodesAboutToBeAdded(this, m_children.size(), 1);
439  a_child->m_parentNode = this;
440  m_children.push_back(a_child);
441 // m_model->nodesAdded(this);
442 }
443 
444 void Node::removeNode(Node* a_child)
445 {
446  int row = a_child->row();
447  m_model->nodesAboutToBeRemoved(this, row, row);
448  m_children.removeAt(row);
449  delete a_child;
450  m_model->nodesRemoved(this);
451 }
452 
453 // Sort algorithm for the nodes.
454 struct SortNodesFunctor
455 {
456  bool operator()(Node* a_lhs, Node* a_rhs)
457  {
458  if (a_lhs->score() == a_rhs->score()) {
459  return a_lhs->sortableString() < a_rhs->sortableString();
460  } else
461  return a_lhs->score() < a_rhs->score();
462  }
463 };
464 
465 void Node::recursiveSortInternal()
466 {
467  // Sort my nodes.
468  std::sort(m_children.begin(), m_children.end(), SortNodesFunctor());
469 
470  // Tell each node to sort it self.
471  for (Node* node : qAsConst(m_children)) {
472  node->recursiveSortInternal();
473  }
474 }
475 
476 void Node::recursiveSort()
477 {
478  m_model->nodesLayoutAboutToBeChanged(this);
479 
480  recursiveSortInternal();
481 
482  m_model->nodesLayoutChanged(this);
483 }
484 
485 int Node::row()
486 {
487  if (m_parentNode == nullptr)
488  return -1;
489 
490  return m_parentNode->m_children.indexOf(this);
491 }
492 
493 QIcon ClassModelNodes::Node::cachedIcon()
494 {
495  // Load the cached icon if it's null.
496  if (m_cachedIcon.isNull()) {
497  if (!getIcon(m_cachedIcon))
498  m_cachedIcon = QIcon();
499  }
500 
501  return m_cachedIcon;
502 }
503 
506 
507 DynamicNode::DynamicNode(const QString& a_displayName, NodesModelInterface* a_model)
508  : Node(a_displayName, a_model)
509  , m_populated(false)
510 {
511 }
512 
513 void DynamicNode::collapse()
514 {
515  performNodeCleanup();
516 }
517 
518 void DynamicNode::expand()
519 {
520  performPopulateNode();
521 }
522 
523 void DynamicNode::performNodeCleanup()
524 {
525  if (!m_populated)
526  return;
527 
528  if (!m_children.empty()) {
529  // Notify model for this node.
530  m_model->nodesAboutToBeRemoved(this, 0, m_children.size() - 1);
531 
532  // Clear sub-nodes.
533  clear();
534 
535  m_model->nodesRemoved(this);
536  }
537 
538  // This shouldn't be called from clear since clear is called also from the d-tor
539  // and the function is virtual.
540  nodeCleared();
541 
542  // Mark the fact that we've been collapsed
543  m_populated = false;
544 }
545 
546 void DynamicNode::performPopulateNode(bool a_forceRepopulate)
547 {
548  if (m_populated) {
549  if (a_forceRepopulate)
550  performNodeCleanup();
551  else
552  return;
553  }
554 
555  populateNode();
556 
557  // We're populated.
558  m_populated = true;
559 
560  // Sort the list.
561  recursiveSort();
562 }
563 
564 bool DynamicNode::hasChildren() const
565 {
566  // To get a true status, we'll need to populate the node.
567  const_cast<DynamicNode*>(this)->performPopulateNode();
568 
569  return !m_children.empty();
570 }
ClassModelNodes::DynamicFolderNode
Provides a folder node with a dynamic list of nodes.
Definition: classmodelnode.h:297
QList::clear
void clear()
ClassModelNodes::FunctionNode
Provides a display for a single class function.
Definition: classmodelnode.h:249
ClassModelNodes::DynamicNode::hasChildren
bool hasChildren() const override
Return true if the node contains sub-nodes.
Definition: classmodelnode.cpp:564
ClassModelNodes::EnumNode::populateNode
void populateNode() override
Called by the framework when the node is about to be expanded it should be populated with sub-nodes i...
Definition: classmodelnode.cpp:104
ClassModelNodes::ClassNode::~ClassNode
~ClassNode() override
Definition: classmodelnode.cpp:126
QList::push_back
void push_back(const T &value)
NodesModelInterface::features
virtual Features features() const =0
ClassModelNodes::IdentifierNode::getIcon
bool getIcon(QIcon &a_resultIcon) override
fill a_resultIcon with a display icon for the node.
Definition: classmodelnode.cpp:60
QList::removeAt
void removeAt(int i)
ClassModelNodes::EnumNode::getIcon
bool getIcon(QIcon &a_resultIcon) override
fill a_resultIcon with a display icon for the node.
Definition: classmodelnode.cpp:82
ClassModelNodes::Node::score
virtual int score() const =0
Return a score when sorting the nodes.
ClassModelNodes::DynamicNode::performPopulateNode
void performPopulateNode(bool a_forceRepopulate=false)
Populate the node and mark the flag - called from expand or can be used internally.
Definition: classmodelnode.cpp:546
ClassModelNodesController::self
static ClassModelNodesController & self()
Definition: classmodelnodescontroller.cpp:46
NodesModelInterface::BaseAndDerivedClasses
Definition: classmodel.h:59
QMap::clear
void clear()
ClassModelNodes::Node::~Node
virtual ~Node()
Definition: classmodelnode.cpp:418
ClassModelNodes::FunctionNode::FunctionNode
FunctionNode(KDevelop::Declaration *a_decl, NodesModelInterface *a_model)
Definition: classmodelnode.cpp:277
QList::size
int size() const
ClassModelNodes::ClassNode
Provides display for a single class.
Definition: classmodelnode.h:206
QList::indexOf
int indexOf(const T &value, int from) const
ClassModelNodes::Node
Base node class - provides basic functionality.
Definition: classmodelnode.h:45
ClassModelNodes::Node::cachedIcon
QIcon cachedIcon()
Return an icon representation for the node.
Definition: classmodelnode.cpp:493
ClassModelNodes::DynamicFolderNode::DynamicFolderNode
DynamicFolderNode(const QString &a_displayName, NodesModelInterface *a_model)
Definition: classmodelnode.cpp:329
ClassModelNodes::BaseClassesFolderNode
Special folder - the parent is assumed to be a ClassNode.
Definition: classmodelnode.h:313
NodesModelInterface
The model interface accessible from the nodes.
Definition: classmodel.h:51
ClassModelNodes::ClassNode::populateNode
void populateNode() override
Called by the framework when the node is about to be expanded it should be populated with sub-nodes i...
Definition: classmodelnode.cpp:134
QList::empty
bool empty() const
ClassModelNodes::ClassMemberNode::getIcon
bool getIcon(QIcon &a_resultIcon) override
fill a_resultIcon with a display icon for the node.
Definition: classmodelnode.cpp:304
ClassModelNodes::DynamicNode::populateNode
virtual void populateNode()
Called by the framework when the node is about to be expanded it should be populated with sub-nodes i...
Definition: classmodelnode.h:144
ClassModelNodes::DynamicNode::DynamicNode
DynamicNode(const QString &a_displayName, NodesModelInterface *a_model)
Definition: classmodelnode.cpp:507
ClassModelNodes::EnumNode
A node that represents an enum value.
Definition: classmodelnode.h:190
ClassModelNodesController::unregisterForChanges
void unregisterForChanges(const KDevelop::IndexedString &a_file, ClassModelNodeDocumentChangedInterface *a_node)
Unregister the given class node from further notifications.
Definition: classmodelnodescontroller.cpp:58
QString::isEmpty
bool isEmpty() const
ClassModelNodes::BaseClassesFolderNode::BaseClassesFolderNode
BaseClassesFolderNode(NodesModelInterface *a_model)
Definition: classmodelnode.cpp:357
ClassModelNodes::EnumNode::EnumNode
EnumNode(KDevelop::Declaration *a_decl, NodesModelInterface *a_model)
Definition: classmodelnode.cpp:74
ClassModelNodes::DerivedClassesFolderNode::populateNode
void populateNode() override
Called by the framework when the node is about to be expanded it should be populated with sub-nodes i...
Definition: classmodelnode.cpp:393
ClassModelNodes::DynamicNode
Base class for nodes that generate and populate their child nodes dynamically.
Definition: classmodelnode.h:124
ClassModelNodes::FolderNode::FolderNode
FolderNode(const QString &a_displayName, NodesModelInterface *a_model)
Definition: classmodelnode.cpp:343
qMapLessThanKey
bool qMapLessThanKey(const IndexedIdentifier &key1, const IndexedIdentifier &key2)
Definition: classmodelnode.cpp:150
ClassModelNodes::Node::m_children
NodesList m_children
Definition: classmodelnode.h:114
ClassModelNodes::Node::sortableString
virtual QString sortableString() const
We use this string when sorting items.
Definition: classmodelnode.h:98
ClassModelNodes::Node::recursiveSort
void recursiveSort()
Called once the node has been populated to sort the entire tree / branch.
Definition: classmodelnode.cpp:476
QString
QList
ClassModelNodes::Node::row
int row()
Get my index in the parent node.
Definition: classmodelnode.cpp:485
ClassModelNodes::BaseClassesFolderNode::populateNode
void populateNode() override
Called by the framework when the node is about to be expanded it should be populated with sub-nodes i...
Definition: classmodelnode.cpp:362
ClassModelNodes::ClassNode::documentChanged
void documentChanged(const KDevelop::IndexedString &a_file) override
Called when the registered document is changed.
Definition: classmodelnode.cpp:247
ClassModelNodes::IdentifierNode
Base class for nodes associated with a KDevelop::QualifiedIdentifier.
Definition: classmodelnode.h:161
QList::end
iterator end()
ClassModelNodes::Node::parent
Node * parent() const
Return the parent associated with this node.
Definition: classmodelnode.h:75
ClassModelNodes::DynamicNode::expand
void expand() override
Called by the model to expand the node and populate it with sub-nodes if needed.
Definition: classmodelnode.cpp:518
ClassModelNodes::ClassNode::nodeCleared
void nodeCleared() override
Called after the nodes have been removed.
Definition: classmodelnode.cpp:237
QLatin1Char
ClassModelNodes::ClassMemberNode::ClassMemberNode
ClassMemberNode(KDevelop::ClassMemberDeclaration *a_decl, NodesModelInterface *a_model)
Definition: classmodelnode.cpp:299
ClassModelNodes::DerivedClassesFolderNode::DerivedClassesFolderNode
DerivedClassesFolderNode(NodesModelInterface *a_model)
Definition: classmodelnode.cpp:388
ClassModelNodes::DynamicFolderNode::getIcon
bool getIcon(QIcon &a_resultIcon) override
fill a_resultIcon with a display icon for the node.
Definition: classmodelnode.cpp:334
ClassModelNodesController::registerForChanges
void registerForChanges(const KDevelop::IndexedString &a_file, ClassModelNodeDocumentChangedInterface *a_node)
Register the given class node to receive notifications about its top context changes.
Definition: classmodelnodescontroller.cpp:52
ClassModelNodes::FolderNode::getIcon
bool getIcon(QIcon &a_resultIcon) override
fill a_resultIcon with a display icon for the node.
Definition: classmodelnode.cpp:348
ClassModelNodes::IdentifierNode::declaration
virtual KDevelop::Declaration * declaration()
Return the associated declaration.
Definition: classmodelnode.cpp:52
ClassModelNodes::Node::m_displayName
QString m_displayName
Definition: classmodelnode.h:115
ClassModelNodes::ClassNode::ClassNode
ClassNode(KDevelop::Declaration *a_decl, NodesModelInterface *a_model)
Definition: classmodelnode.cpp:121
QIcon::isNull
bool isNull() const
NodesModelInterface::nodesLayoutAboutToBeChanged
virtual void nodesLayoutAboutToBeChanged(ClassModelNodes::Node *a_parent)=0
ClassModelNodes::DynamicNode::collapse
void collapse() override
Called by the model to collapse the node and remove sub-items if needed.
Definition: classmodelnode.cpp:513
NodesModelInterface::nodesRemoved
virtual void nodesRemoved(ClassModelNodes::Node *a_parent)=0
ClassModelNodes::DynamicNode::nodeCleared
virtual void nodeCleared()
Called after the nodes have been removed.
Definition: classmodelnode.h:148
ClassModelNodes::Node::addNode
void addNode(Node *a_child)
Append a new child node to the list.
Definition: classmodelnode.cpp:434
ClassModelNodes::Node::m_model
NodesModelInterface * m_model
Definition: classmodelnode.h:117
QIcon::fromTheme
QIcon fromTheme(const QString &name, const QIcon &fallback)
NodesModelInterface::nodesLayoutChanged
virtual void nodesLayoutChanged(ClassModelNodes::Node *a_parent)=0
QMap::insert
iterator insert(const Key &key, const T &value)
classmodelnode.h
NodesModelInterface::ClassInternals
Definition: classmodel.h:60
NodesModelInterface::nodesAboutToBeRemoved
virtual void nodesAboutToBeRemoved(ClassModelNodes::Node *a_parent, int a_first, int a_last)=0
ClassModelNodes::ClassMemberNode
Provides display for a single class variable.
Definition: classmodelnode.h:267
ClassModelNodes::Node::clear
void clear()
Clear all the children from the node.
Definition: classmodelnode.cpp:428
ClassModelNodes::ClassNode::findSubClass
ClassNode * findSubClass(const KDevelop::IndexedQualifiedIdentifier &a_id)
Lookup a contained class and return the related node.
Definition: classmodelnode.cpp:255
QMap::find
iterator find(const Key &key)
QList::begin
iterator begin()
ClassModelNodes::Node::removeNode
void removeNode(Node *a_child)
Remove child node from the list and delete it.
Definition: classmodelnode.cpp:444
ClassModelNodes::Node::Node
Node(const QString &a_displayName, NodesModelInterface *a_model)
Definition: classmodelnode.cpp:411
QIcon
ClassModelNodes::DerivedClassesFolderNode
Special folder - the parent is assumed to be a ClassNode.
Definition: classmodelnode.h:328
QMap::remove
int remove(const Key &key)
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Dec 9 2019 02:47:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevelop/kdevplatform/language/classmodel

Skip menu "kdevelop/kdevplatform/language/classmodel"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  •   kdevplatform
  •     debugger
  •     documentation
  •     interfaces
  •     language
  •       assistant
  •       backgroundparser
  •       checks
  •       classmodel
  •       codecompletion
  •       codegen
  •       duchain
  •       editor
  •       highlighting
  •       interfaces
  •       util
  •     outputview
  •     project
  •     serialization
  •     shell
  •     sublime
  •     tests
  •     util
  •     vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal