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

kdevplatform/language/duchain

  • KDevelop
  • AbstractTypeBuilder
Public Member Functions | Protected Member Functions | List of all members
KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase > Class Template Reference

#include <abstracttypebuilder.h>

Inheritance diagram for KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >:
Inheritance graph
[legend]

Public Member Functions

const QList< AbstractType::Ptr > & topTypes () const
 

Protected Member Functions

virtual void classTypeOpened (const KDevelop::AbstractType::Ptr &)
 
void clearLastType ()
 
void closeType ()
 
AbstractType::Ptr currentAbstractType ()
 
template<class T2 >
TypePtr< T2 > currentType ()
 
bool hasCurrentType ()
 
void injectType (const AbstractType::Ptr &type)
 
template<class T2 >
void injectType (const TypePtr< T2 > &type)
 
AbstractType::Ptr lastType () const
 
void openAbstractType (const AbstractType::Ptr &type)
 
template<class T2 >
void openType (const TypePtr< T2 > &type)
 
bool openTypeFromName (const QualifiedIdentifier &id, T *typeNode, bool needClass)
 
bool openTypeFromName (NameT *name, bool needClass)
 
virtual DUContext * searchContext () const
 
void setLastType (const AbstractType::Ptr &ptr)
 
void supportBuild (T *node, DUContext *context=nullptr) override
 

Detailed Description

template<typename T, typename NameT, typename LangugageSpecificTypeBuilderBase>
class KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >

Abstract definition-use chain type builder class.

The AbstractTypeBuilder is a convenience class template for creating customized definition-use chain type builders from an AST. It simplifies:

  • creating and re-using types
  • creating complex types in a stack
  • referencing named types
Author
Hamish Rodda <rodda[email protected]@kde[email protected].org>

Definition at line 40 of file abstracttypebuilder.h.

Member Function Documentation

◆ classTypeOpened()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
virtual void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::classTypeOpened ( const KDevelop::AbstractType::Ptr &  )
inlineprotectedvirtual

Notify that a class type was opened.

This should be called at the beginning of processing a class-specifier, right after the type for the class was created. The type can be retrieved through currentAbstractType().

Definition at line 74 of file abstracttypebuilder.h.

◆ clearLastType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::clearLastType ( )
inlineprotected

Clear the last encountered type.

Definition at line 109 of file abstracttypebuilder.h.

◆ closeType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::closeType ( )
inlineprotected

Close the current type.

Definition at line 150 of file abstracttypebuilder.h.

◆ currentAbstractType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
AbstractType::Ptr KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::currentAbstractType ( )
inlineprotected

Retrieve the current type being parsed.

Warning
You must not use this in creating another type definition, as it may not be a registered type.
Returns
the current abstract type being parsed.

Definition at line 173 of file abstracttypebuilder.h.

◆ currentType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
template<class T2 >
TypePtr<T2> KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::currentType ( )
inlineprotected

Retrieve the current type being parsed.

Warning
You must not use this in creating another type definition, as it may not be a registered type.
Returns
the current type being parsed.

Definition at line 190 of file abstracttypebuilder.h.

◆ hasCurrentType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
bool KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::hasCurrentType ( )
inlineprotected

Determine if the type builder is currently parsing a type.

Returns
true if there is a current type, else returns false.

Definition at line 164 of file abstracttypebuilder.h.

◆ injectType() [1/2]

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::injectType ( const AbstractType::Ptr &  type)
inlineprotected

Simulates that the given type was created.

After calling, this type will be the last type.

Definition at line 118 of file abstracttypebuilder.h.

◆ injectType() [2/2]

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
template<class T2 >
void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::injectType ( const TypePtr< T2 > &  type)
inlineprotected

Simulates that the given type was created.

After calling, this type will be the last type.

Definition at line 129 of file abstracttypebuilder.h.

◆ lastType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
AbstractType::Ptr KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::lastType ( ) const
inlineprotected

Retrieve the last type that was encountered.

Returns
the last encountered type.

Definition at line 93 of file abstracttypebuilder.h.

◆ openAbstractType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::openAbstractType ( const AbstractType::Ptr &  type)
inlineprotected

Opens the given type, and sets it to be the current type.

Definition at line 142 of file abstracttypebuilder.h.

◆ openType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
template<class T2 >
void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::openType ( const TypePtr< T2 > &  type)
inlineprotected

Opens the given type, and sets it to be the current type.

Definition at line 136 of file abstracttypebuilder.h.

◆ openTypeFromName() [1/2]

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
bool KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::openTypeFromName ( const QualifiedIdentifier &  id,
T *  typeNode,
bool  needClass 
)
inlineprotected

Search for a type with the identifier given by name.

Parameters
idthe identifier of the type for which to search.
typeNodethe AST node representing the type to open.
needClassif true, only class types will be searched, if false all named types will be searched.
Returns
whether a type was found (and thus opened).
Todo:
only functions may have multiple declarations here
Todo:
What about position?

Definition at line 214 of file abstracttypebuilder.h.

◆ openTypeFromName() [2/2]

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
bool KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::openTypeFromName ( NameT *  name,
bool  needClass 
)
inlineprotected

Search for a type with the identifier given by name.

Parameters
namethe AST node representing the name of the type to open.
needClassif true, only class types will be searched, if false all named types will be searched.
Returns
whether a type was found (and thus opened).

Definition at line 200 of file abstracttypebuilder.h.

◆ searchContext()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
virtual DUContext* KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::searchContext ( ) const
inlineprotectedvirtual

Determine the context to search in when named types are requested.

You may reimplement this to return a different context if required.

Returns
the context in which to search for named types.

Definition at line 63 of file abstracttypebuilder.h.

◆ setLastType()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::setLastType ( const AbstractType::Ptr &  ptr)
inlineprotected

Set the last encountered type.

Parameters
ptrpointer to the last encountered type.

Definition at line 103 of file abstracttypebuilder.h.

◆ supportBuild()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::supportBuild ( T *  node,
DUContext *  context = nullptr 
)
inlineoverrideprotected

Perform initialisation at the start of a build, and check that all types that were registered were also used.

Definition at line 80 of file abstracttypebuilder.h.

◆ topTypes()

template<typename T , typename NameT , typename LangugageSpecificTypeBuilderBase >
const QList<AbstractType::Ptr>& KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::topTypes ( ) const
inline

Returns the list of types that were created in the parsing run, excluding subtypes (ie.

returns complete types, not the simple types and intermediate types which went into creating any complex type)

Used for unit tests only.

Definition at line 51 of file abstracttypebuilder.h.


The documentation for this class was generated from the following file:
  • abstracttypebuilder.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Mar 4 2021 23:31:18 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/language/duchain

Skip menu "kdevplatform/language/duchain"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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