language/duchain
KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase > Class Template Reference
Abstract definition-use chain type builder class. More...
#include <abstracttypebuilder.h>
Inherits LangugageSpecificTypeBuilderBase.
Public Member Functions | |
| const QList < KDevelop::AbstractType::Ptr > & | topTypes () const |
Protected Member Functions | |
| virtual void | classTypeOpened (KDevelop::AbstractType::Ptr) |
| void | clearLastType () |
| void | closeType () |
| KDevelop::AbstractType::Ptr | currentAbstractType () |
| template<class T2 > | |
| TypePtr< T2 > | currentType () |
| bool | hasCurrentType () |
| template<class T2 > | |
| void | injectType (const TypePtr< T2 > &type) |
| void | injectType (const KDevelop::AbstractType::Ptr &type) |
| KDevelop::AbstractType::Ptr | lastType () const |
| void | openAbstractType (KDevelop::AbstractType::Ptr type) |
| template<class T2 > | |
| void | openType (TypePtr< T2 > type) |
| bool | openTypeFromName (QualifiedIdentifier id, T *typeNode, bool needClass) |
| bool | openTypeFromName (NameT *name, bool needClass) |
| virtual DUContext * | searchContext () const |
| void | setLastType (KDevelop::AbstractType::Ptr ptr) |
| virtual void | supportBuild (T *node, DUContext *context=0) |
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:
- use of your editor integrator
- creating and re-using types
- creating complex types in a stack
- referencing named types
Definition at line 42 of file abstracttypebuilder.h.
Member Function Documentation
| virtual void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::classTypeOpened | ( | KDevelop::AbstractType::Ptr | ) | [inline, protected, virtual] |
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 75 of file abstracttypebuilder.h.
| void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::clearLastType | ( | ) | [inline, protected] |
Clear the last encountered type.
Definition at line 110 of file abstracttypebuilder.h.
| void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::closeType | ( | ) | [inline, protected] |
Close the current type.
Definition at line 151 of file abstracttypebuilder.h.
| KDevelop::AbstractType::Ptr KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::currentAbstractType | ( | ) | [inline, protected] |
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 174 of file abstracttypebuilder.h.
| TypePtr<T2> KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::currentType | ( | ) | [inline, protected] |
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 184 of file abstracttypebuilder.h.
| bool KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::hasCurrentType | ( | ) | [inline, protected] |
Determine if the type builder is currently parsing a type.
- Returns:
- true if there is a current type, else returns false.
Definition at line 165 of file abstracttypebuilder.h.
| void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::injectType | ( | const TypePtr< T2 > & | type | ) | [inline, protected] |
Simulates that the given type was created.
After calling, this type will be the last type.
Definition at line 130 of file abstracttypebuilder.h.
| void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::injectType | ( | const KDevelop::AbstractType::Ptr & | type | ) | [inline, protected] |
Simulates that the given type was created.
After calling, this type will be the last type.
Definition at line 119 of file abstracttypebuilder.h.
| KDevelop::AbstractType::Ptr KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::lastType | ( | ) | const [inline, protected] |
Retrieve the last type that was encountered.
- Returns:
- the last encountered type.
Definition at line 94 of file abstracttypebuilder.h.
| void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::openAbstractType | ( | KDevelop::AbstractType::Ptr | type | ) | [inline, protected] |
Opens the given type, and sets it to be the current type.
Definition at line 143 of file abstracttypebuilder.h.
| void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::openType | ( | TypePtr< T2 > | type | ) | [inline, protected] |
Opens the given type, and sets it to be the current type.
Definition at line 137 of file abstracttypebuilder.h.
| bool KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::openTypeFromName | ( | QualifiedIdentifier | id, | |
| T * | typeNode, | |||
| bool | needClass | |||
| ) | [inline, protected] |
Search for a type with the identifier given by name.
- Parameters:
-
id the identifier of the type for which to search. typeNode the AST node representing the type to open. needClass if 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 208 of file abstracttypebuilder.h.
| bool KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::openTypeFromName | ( | NameT * | name, | |
| bool | needClass | |||
| ) | [inline, protected] |
Search for a type with the identifier given by name.
- Parameters:
-
name the AST node representing the name of the type to open. needClass if 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 194 of file abstracttypebuilder.h.
| virtual DUContext* KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::searchContext | ( | ) | const [inline, protected, virtual] |
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 64 of file abstracttypebuilder.h.
| void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::setLastType | ( | KDevelop::AbstractType::Ptr | ptr | ) | [inline, protected] |
Set the last encountered type.
- Parameters:
-
ptr pointer to the last encountered type.
Definition at line 104 of file abstracttypebuilder.h.
| virtual void KDevelop::AbstractTypeBuilder< T, NameT, LangugageSpecificTypeBuilderBase >::supportBuild | ( | T * | node, | |
| DUContext * | context = 0 | |||
| ) | [inline, protected, virtual] |
Perform initialisation at the start of a build, and check that all types that were registered were also used.
Definition at line 81 of file abstracttypebuilder.h.
| const QList< KDevelop::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 52 of file abstracttypebuilder.h.
The documentation for this class was generated from the following file:
KDE 4.4 API Reference