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

kdevplatform/language/duchain

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

#include <functiontype.h>

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

Public Types

enum  { Identity = 5 }
 
using Data = FunctionTypeData
 
using Ptr = TypePtr< FunctionType >
 
enum  SignaturePart { SignatureWhole, SignatureReturn, SignatureArguments }
 
- Public Types inherited from KDevelop::AbstractType
enum  { Identity = 1 }
 
enum  CommonModifiers : quint32 {
  NoModifiers = 0, ConstModifier = 1 << 0, VolatileModifier = 1 << 1, TransientModifier = 1 << 2,
  NewModifier = 1 << 3, SealedModifier = 1 << 4, UnsafeModifier = 1 << 5, FixedModifier = 1 << 6,
  ShortModifier = 1 << 7, LongModifier = 1 << 8, LongLongModifier = 1 << 9, SignedModifier = 1 << 10,
  UnsignedModifier = 1 << 11, LanguageSpecificModifier = 1 << 12
}
 
using Data = AbstractTypeData
 
using Ptr = TypePtr< AbstractType >
 
enum  WhichType : quint8 {
  TypeAbstract, TypeIntegral, TypePointer, TypeReference,
  TypeFunction, TypeStructure, TypeArray, TypeDelayed,
  TypeEnumeration, TypeEnumerator, TypeAlias, TypeUnsure
}
 

Public Member Functions

 FunctionType ()
 
 FunctionType (const FunctionType &rhs)
 
 FunctionType (FunctionTypeData &data)
 
 ~FunctionType () override
 
void addArgument (const AbstractType::Ptr &argument, int index=-1)
 
QList< AbstractType::Ptr > arguments () const
 
AbstractType * clone () const override
 
bool equals (const AbstractType *rhs) const override
 
void exchangeTypes (TypeExchanger *exchanger) override
 
uint hash () const override
 
const IndexedType * indexedArguments () const
 
uint indexedArgumentsSize () const
 
FunctionType & operator= (const FunctionType &rhs)=delete
 
virtual QString partToString (SignaturePart sigPart) const
 
void removeArgument (int i)
 
AbstractType::Ptr returnType () const
 
void setReturnType (const AbstractType::Ptr &returnType)
 
QString toString () const override
 
WhichType whichType () const override
 
- Public Member Functions inherited from KDevelop::AbstractType
 AbstractType ()
 
 AbstractType (AbstractTypeData &dd)
 
 AbstractType (const AbstractType &rhs)=delete
 
virtual ~AbstractType ()
 
void accept (TypeVisitor *v) const
 
int64_t alignOf () const
 
IndexedType indexed () const
 
void makeDynamic ()
 
quint32 modifiers () const
 
AbstractType & operator= (const AbstractType &rhs)=delete
 
void setAlignOf (int64_t alignedTo)
 
void setModifiers (quint32 modifiers)
 
void setSizeOf (int64_t sizeOf)
 
int64_t sizeOf () const
 
- Public Member Functions inherited from QSharedData
 QSharedData ()
 
 QSharedData (const QSharedData &other)
 

Protected Member Functions

void accept0 (TypeVisitor *v) const override
 
- Protected Member Functions inherited from KDevelop::AbstractType
QString toString (bool spaceOnLeft) const
 

Additional Inherited Members

- Static Public Member Functions inherited from KDevelop::AbstractType
static void acceptType (AbstractType::Ptr type, TypeVisitor *v)
 
template<class Type >
static Type::Data & copyData (const typename Type::Data &rhs)
 
template<class DataType >
static DataType & copyDataDirectly (const DataType &rhs)
 
template<class Type >
static Type::Data & createData ()
 
- Protected Attributes inherited from KDevelop::AbstractType
AbstractTypeData * d_ptr
 

Detailed Description

A type representing function types.

A FunctionType is represents the type of a function. It provides access to the return type, and number and types of the arguments.

Definition at line 35 of file functiontype.h.

Member Typedef Documentation

◆ Data

using KDevelop::FunctionType::Data = FunctionTypeData

Definition at line 133 of file functiontype.h.

◆ Ptr

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

Definition at line 39 of file functiontype.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Identity 

Definition at line 129 of file functiontype.h.

◆ SignaturePart

enum KDevelop::FunctionType::SignaturePart

An enumeration of sections of the function signature that can be returned.

Enumerator
SignatureWhole 

When this is given to toString(..), a string link "RETURNTYPE (ARGTYPE1, ARGTYPE1, ..)" is returned.

SignatureReturn 

When this is given, only a string that represents the return-type is returned.

SignatureArguments 

When this is given, a string that represents the arguments like "(ARGTYPE1, ARGTYPE1, ..)" is returned.

This does not include a trailing "const" if the function is constant

Definition at line 42 of file functiontype.h.

Constructor & Destructor Documentation

◆ FunctionType() [1/3]

KDevelop::FunctionType::FunctionType ( )

Default constructor.

Definition at line 75 of file functiontype.cpp.

◆ FunctionType() [2/3]

KDevelop::FunctionType::FunctionType ( const FunctionType &  rhs)

Copy constructor.

Parameters
rhstype to copy

Definition at line 33 of file functiontype.cpp.

◆ FunctionType() [3/3]

KDevelop::FunctionType::FunctionType ( FunctionTypeData &  data)
explicit

Constructor using raw data.

Parameters
datainternal data.

Definition at line 37 of file functiontype.cpp.

◆ ~FunctionType()

KDevelop::FunctionType::~FunctionType ( )
override

Destructor.

Definition at line 80 of file functiontype.cpp.

Member Function Documentation

◆ accept0()

void KDevelop::FunctionType::accept0 ( TypeVisitor *  v) const
overrideprotectedvirtual

Visitor method, reimplement to allow visiting of types.

Parameters
vvisitor which is visiting.

Implements KDevelop::AbstractType.

Definition at line 127 of file functiontype.cpp.

◆ addArgument()

void KDevelop::FunctionType::addArgument ( const AbstractType::Ptr &  argument,
int  index = -1 
)

Add an argument to the function, specifying what type it takes.

Parameters
argumentthe argument's type
indexwhere to insert the argument; the default "-1" will insert it at the end of the list

Definition at line 84 of file functiontype.cpp.

◆ arguments()

QList< AbstractType::Ptr > KDevelop::FunctionType::arguments ( ) const

Retrieve the list of types of the function's arguments.

Returns
the argument types.
Todo:
Don't do the conversion

Definition at line 107 of file functiontype.cpp.

◆ clone()

AbstractType * KDevelop::FunctionType::clone ( ) const
overridevirtual

Should create a clone of the source-type, with as much data copied as possible without breaking the du-chain.

Implements KDevelop::AbstractType.

Definition at line 41 of file functiontype.cpp.

◆ equals()

bool KDevelop::FunctionType::equals ( const AbstractType *  rhs) const
overridevirtual

Should return whether this type's content equals the given one Since this is used by the type-repository, it must compare ALL members of the data type.

Reimplemented from KDevelop::AbstractType.

Definition at line 46 of file functiontype.cpp.

◆ exchangeTypes()

void KDevelop::FunctionType::exchangeTypes ( TypeExchanger *  exchanger)
overridevirtual

Should, like accept0, be implemented by all types that hold references to other types.

If this is called on one type, that type should call exchangeTypes(..) with all its referenced sub-types. The type itself does not recurse into the sub-types, that can be done by the exchanger itself if desired.

Reimplemented from KDevelop::AbstractType.

Definition at line 140 of file functiontype.cpp.

◆ hash()

uint KDevelop::FunctionType::hash ( ) const
overridevirtual

A hash-value that should have the following properties:

  • When two types match on equals(), it should be same.
  • When two types don't match on equals(), it should be different with a high probability.

Reimplemented from KDevelop::AbstractType.

Definition at line 183 of file functiontype.cpp.

◆ indexedArguments()

const IndexedType * KDevelop::FunctionType::indexedArguments ( ) const

Returns the same arguemtns as arguments(), but without converting them to a QList.

This is much faster, and should be preferred for very tight loops when the performance counts.

Returns
an array that contains the arguments. For the count of arguments, call indexedArgumentsSize

Definition at line 117 of file functiontype.cpp.

◆ indexedArgumentsSize()

uint KDevelop::FunctionType::indexedArgumentsSize ( ) const

Returns the size of the array returned by indexedArguments().

This is much faster than working with arguments().

Definition at line 122 of file functiontype.cpp.

◆ operator=()

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

◆ partToString()

QString KDevelop::FunctionType::partToString ( SignaturePart  sigPart) const
virtual

This function creates a string that represents the requested part of this function's signature.

Parameters
sigPartpart of the signature requested.
Returns
the signature as text.

Definition at line 149 of file functiontype.cpp.

◆ removeArgument()

void KDevelop::FunctionType::removeArgument ( int  i)

Remove the argument with number i from the function.

Parameters
iindex (starting from 0 with the first argument) to remove

Definition at line 92 of file functiontype.cpp.

◆ returnType()

AbstractType::Ptr KDevelop::FunctionType::returnType ( ) const

Retrieve the return type of the function.

Returns
the return type.

Definition at line 102 of file functiontype.cpp.

◆ setReturnType()

void KDevelop::FunctionType::setReturnType ( const AbstractType::Ptr &  returnType)

Sets the return type of the function.

Parameters
returnTypethe return type.

Definition at line 97 of file functiontype.cpp.

◆ toString()

QString KDevelop::FunctionType::toString ( ) const
overridevirtual

Returns this type as a string, preferably the same as it is expressed in the code.

Returns
this type as a string

Reimplemented from KDevelop::AbstractType.

Definition at line 173 of file functiontype.cpp.

◆ whichType()

AbstractType::WhichType KDevelop::FunctionType::whichType ( ) const
overridevirtual

Determine which data type this abstract type represents.

Returns
the data type represented by this type.

Reimplemented from KDevelop::AbstractType.

Definition at line 178 of file functiontype.cpp.


The documentation for this class was generated from the following files:
  • functiontype.h
  • functiontype.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Mar 7 2021 23:29:31 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