language/duchain
functiontype.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FUNCTIONTYPE_H
00022 #define FUNCTIONTYPE_H
00023
00024 #include "abstracttype.h"
00025
00026 namespace KDevelop
00027 {
00028 class FunctionTypeData;
00029
00036 class KDEVPLATFORMLANGUAGE_EXPORT FunctionType : public AbstractType
00037 {
00038 public:
00039 typedef TypePtr<FunctionType> Ptr;
00040
00042 enum SignaturePart {
00043 SignatureWhole ,
00044 SignatureReturn ,
00045 SignatureArguments
00047 };
00048
00050 FunctionType();
00052 FunctionType(const FunctionType& rhs);
00054 FunctionType(FunctionTypeData& data);
00056 ~FunctionType();
00057
00063 AbstractType::Ptr returnType () const;
00064
00070 void setReturnType(AbstractType::Ptr returnType);
00071
00077 QList<AbstractType::Ptr> arguments () const;
00078
00084 const IndexedType* indexedArguments() const;
00085
00089 uint indexedArgumentsSize() const;
00090
00096 void addArgument(AbstractType::Ptr argument);
00097
00104 void removeArgument(AbstractType::Ptr argument);
00105
00106 virtual AbstractType* clone() const;
00107
00108 virtual bool equals(const AbstractType* rhs) const;
00109
00110 virtual QString toString() const;
00111
00119 virtual QString partToString( SignaturePart sigPart ) const;
00120
00121 virtual uint hash() const;
00122
00123 virtual WhichType whichType() const;
00124
00125 virtual void exchangeTypes( TypeExchanger* exchanger );
00126
00127 enum {
00128 Identity = 5
00129 };
00130
00131 typedef FunctionTypeData Data;
00132
00133 protected:
00134 virtual void accept0 (TypeVisitor *v) const;
00135
00136 TYPE_DECLARE_DATA(FunctionType)
00137 };
00138
00139 template<>
00140 inline FunctionType* fastCast<FunctionType*>(AbstractType* from) {
00141 if(!from || from->whichType() != AbstractType::TypeFunction)
00142 return 0;
00143 else
00144 return static_cast<FunctionType*>(from);
00145 }
00146
00147 }
00148
00149 #endif
00150
00151