• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDevelop Platform Libraries
  • Sitemap
  • Contact Us
 

language/duchain

KDevelop::FunctionType

KDevelop::FunctionType Class Reference

A type representing function types. More...

#include <functiontype.h>

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

List of all members.

Public Types

enum  { Identity = 5 }
typedef FunctionTypeData Data
typedef TypePtr< FunctionType > Ptr
enum  SignaturePart { SignatureWhole, SignatureReturn, SignatureArguments }

Public Member Functions

 FunctionType (FunctionTypeData &data)
 FunctionType (const FunctionType &rhs)
 FunctionType ()
 ~FunctionType ()
void addArgument (AbstractType::Ptr argument)
QList< AbstractType::Ptr > arguments () const
virtual AbstractType * clone () const
virtual bool equals (const AbstractType *rhs) const
virtual void exchangeTypes (TypeExchanger *exchanger)
virtual uint hash () const
const IndexedType * indexedArguments () const
uint indexedArgumentsSize () const
virtual QString partToString (SignaturePart sigPart) const
void removeArgument (AbstractType::Ptr argument)
AbstractType::Ptr returnType () const
void setReturnType (AbstractType::Ptr returnType)
virtual QString toString () const
virtual WhichType whichType () const

Protected Member Functions

virtual void accept0 (TypeVisitor *v) const

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 36 of file functiontype.h.


Member Enumeration Documentation

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 returend.

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

Definition at line 42 of file functiontype.h.


Constructor & Destructor Documentation

KDevelop::FunctionType::FunctionType (  ) 

Default constructor.

Definition at line 75 of file functiontype.cpp.

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

Copy constructor.

Parameters:
rhs type to copy

Definition at line 36 of file functiontype.cpp.

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

Constructor using raw data.

Parameters:
data internal data.

Definition at line 39 of file functiontype.cpp.

KDevelop::FunctionType::~FunctionType (  ) 

Destructor.

Definition at line 80 of file functiontype.cpp.


Member Function Documentation

void KDevelop::FunctionType::accept0 ( TypeVisitor *  v  )  const [protected, virtual]

Visitor method, reimplement to allow visiting of types.

Parameters:
v visitor which is visiting.

Implements KDevelop::AbstractType.

Definition at line 135 of file functiontype.cpp.

void KDevelop::FunctionType::addArgument ( AbstractType::Ptr  argument  ) 

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

Parameters:
argument the argument's type

Definition at line 85 of file functiontype.cpp.

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 116 of file functiontype.cpp.

AbstractType * KDevelop::FunctionType::clone (  )  const [virtual]

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 42 of file functiontype.cpp.

void KDevelop::FunctionType::exchangeTypes ( TypeExchanger *  exchanger  )  [virtual]

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 149 of file functiontype.cpp.

uint KDevelop::FunctionType::hash (  )  const [virtual]

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 194 of file functiontype.cpp.

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 125 of file functiontype.cpp.

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 130 of file functiontype.cpp.

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

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

Parameters:
sigPart part of the signature requested.
Returns:
the signature as text.

Definition at line 157 of file functiontype.cpp.

void KDevelop::FunctionType::removeArgument ( AbstractType::Ptr  argument  ) 

Remove an argument type from the function.

Parameters:
argument the argument type to remove
Todo:
this function doesn't seem to be used, remove it?

Definition at line 90 of file functiontype.cpp.

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

Retrieve the return type of the function.

Returns:
the return type.

Definition at line 111 of file functiontype.cpp.

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

Sets the return type of the function.

Parameters:
returnType the return type.

Definition at line 106 of file functiontype.cpp.

QString KDevelop::FunctionType::toString (  )  const [virtual]

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 184 of file functiontype.cpp.

AbstractType::WhichType KDevelop::FunctionType::whichType (  )  const [virtual]

Determine which data type this abstract type represents.

Returns:
the data type represented by this type.

Reimplemented from KDevelop::AbstractType.

Definition at line 189 of file functiontype.cpp.


The documentation for this class was generated from the following files:
  • functiontype.h
  • functiontype.cpp

language/duchain

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

KDevelop Platform Libraries

Skip menu "KDevelop Platform Libraries"
  • interfaces
  • language
  •   codegen
  •   duchain
  •   editor
  • outputview
  • project
  • shell
  • sublime
  • util
  • vcs
Generated for KDevelop Platform Libraries by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal