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

kdevplatform/language/duchain

  • KDevelop
  • ListType
Public Types | Public Member Functions | Protected Member Functions | List of all members
KDevelop::ListType Class Reference

#include <containertypes.h>

Inheritance diagram for KDevelop::ListType:
Inheritance graph
[legend]

Public Types

enum  { Identity = 58 }
 
using Data = ListTypeData
 
using Ptr = TypePtr< ListType >
 
- Public Types inherited from KDevelop::StructureType
enum  { Identity = 6 }
 
using Data = StructureTypeData
 
using Ptr = TypePtr< StructureType >
 

Public Member Functions

 ListType ()
 
 ListType (const ListType &rhs)
 
 ListType (StructureTypeData &data)
 
template<typename LanguageUnsureType >
void addContentType (const AbstractType::Ptr &typeToAdd)
 
AbstractType * clone () const override
 
QString containerToString () const
 
IndexedType contentType () const
 
bool equals (const AbstractType *rhs) const override
 
uint hash () const override
 
ListType & operator= (const ListType &rhs)=delete
 
void replaceContentType (const AbstractType::Ptr &newType)
 
QString toString () const override
 
- Public Member Functions inherited from KDevelop::StructureType
 StructureType ()
 
 StructureType (const StructureType &rhs)
 
 StructureType (StructureTypeData &data)
 
 ~StructureType () override
 
AbstractType * clone () const override
 
bool equals (const AbstractType *rhs) const override
 
uint hash () const override
 
StructureType & operator= (const StructureType &rhs)=delete
 
QString toString () const override
 
WhichType whichType () const override
 
- Public Member Functions inherited from KDevelop::MergeIdentifiedType< Parent >
 MergeIdentifiedType ()
 
 MergeIdentifiedType (const MergeIdentifiedType &rhs)=delete
 
 MergeIdentifiedType (Data &data)
 
bool equals (const KDevelop::AbstractType *rhs) const override
 
const IdentifiedTypeData * idData () const override
 
IdentifiedTypeData * idData () override
 
- Public Member Functions inherited from KDevelop::IdentifiedType
virtual ~IdentifiedType ()
 
void clear ()
 
Declaration * declaration (const TopDUContext *top) const
 
DeclarationId declarationId () const
 
bool equals (const IdentifiedType *rhs) const
 
uint hash () const
 
DUContext * internalContext (const TopDUContext *top) const
 
QualifiedIdentifier qualifiedIdentifier () const
 
void setDeclaration (Declaration *declaration)
 
void setDeclarationId (const DeclarationId &id)
 

Protected Member Functions

 TYPE_DECLARE_DATA (ListType)
 
- Protected Member Functions inherited from KDevelop::StructureType
void accept0 (TypeVisitor *v) const override
 

Detailed Description

Represents a list-like object which can have a content type.

Example for Python:

# in the file describing the built-in list type
class List: # (1)
pass
# in the user's code:
a = [] # (2)
a.append(3) # (3)

This type class can be used to determine the type of a as "list of int" as follows: (1) When creating the type for the List class, create a ListType instead of a structure type. (Your language plugin somehow needs to know which classes are list-like; Python does this through special comments for the class) (2) Set the type of a to the type declared by the List class, as usual. (3) Call

static_cast<ListType*>(a->abstractType())->addContentType(int_type)

(Your language plugin needs to know which methods add their argument's content to the type's content; Python does this through special comments for the method)

Definition at line 83 of file containertypes.h.

Member Typedef Documentation

◆ Data

using KDevelop::ListType::Data = ListTypeData

Definition at line 145 of file containertypes.h.

◆ Ptr

using KDevelop::ListType::Ptr = TypePtr<ListType>

Definition at line 87 of file containertypes.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Identity 

Definition at line 143 of file containertypes.h.

Constructor & Destructor Documentation

◆ ListType() [1/3]

KDevelop::ListType::ListType ( )

Definition at line 33 of file containertypes.cpp.

◆ ListType() [2/3]

KDevelop::ListType::ListType ( const ListType &  rhs)

Definition at line 39 of file containertypes.cpp.

◆ ListType() [3/3]

KDevelop::ListType::ListType ( StructureTypeData &  data)
explicit

Definition at line 36 of file containertypes.cpp.

Member Function Documentation

◆ addContentType()

template<typename LanguageUnsureType >
void KDevelop::ListType::addContentType ( const AbstractType::Ptr &  typeToAdd)
inline

Adds typeToAdd to the content type of this list.

If the list currently has no type, it is set to this type. If typeToAdd equals this list's content type, or is a useless type nothing happens. Otherwise, the type of the list becomes an unsure type of the previous and typeToAdd.

Pass your language's UnsureType as a template parameter, as it will eventually need to be instantiated.

Note
If the type is already assigned to a declaration, the duchain must be write-locked when this is called.
Parameters
typeToAddThe new type the list's contents can possibly be of.

Definition at line 113 of file containertypes.h.

◆ clone()

AbstractType * KDevelop::ListType::clone ( ) const
override

Definition at line 71 of file containertypes.cpp.

◆ containerToString()

QString KDevelop::ListType::containerToString ( ) const

Return only the container type, not the content type in a string.

Definition at line 104 of file containertypes.cpp.

◆ contentType()

IndexedType KDevelop::ListType::contentType ( ) const

Get this lists's content type.

Definition at line 61 of file containertypes.cpp.

◆ equals()

bool KDevelop::ListType::equals ( const AbstractType *  rhs) const
override

Definition at line 109 of file containertypes.cpp.

◆ hash()

uint KDevelop::ListType::hash ( ) const
override

Definition at line 137 of file containertypes.cpp.

◆ operator=()

ListType& KDevelop::ListType::operator= ( const ListType &  rhs)
delete

◆ replaceContentType()

void KDevelop::ListType::replaceContentType ( const AbstractType::Ptr &  newType)

Replaces this list's content type by newType.

Definition at line 51 of file containertypes.cpp.

◆ toString()

QString KDevelop::ListType::toString ( ) const
override

Formats this type (base type and content type) in a string.

Definition at line 81 of file containertypes.cpp.

◆ TYPE_DECLARE_DATA()

KDevelop::ListType::TYPE_DECLARE_DATA ( ListType  )
protected

The documentation for this class was generated from the following files:
  • containertypes.h
  • containertypes.cpp
KDevelop::ListType::addContentType
void addContentType(const AbstractType::Ptr &typeToAdd)
Adds typeToAdd to the content type of this list.
Definition: containertypes.h:113
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