UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Signature.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2// uLang Compiler Public API
3
4#pragma once
5
8
9namespace uLang
10{
11 class CDataDefinition;
12
17{
19
20 // Methods
21
22 SSignature(const CFunctionType& FunctionType, ParamDefinitions&& Params)
23 : _FunctionType(&FunctionType)
24 , _Params(Move(Params))
25 {}
26
27 // @TODO: This represents an invalid signature (likely, yet to be fully analyzed) -- we should
28 // promote this invalid state up to the use sites (say, have an TOptional<SSignature> instead)
29 SSignature() = default;
30
31 void SetFunctionType(const CFunctionType* FunctionType) { _FunctionType = FunctionType; }
32 void SetParams(ParamDefinitions&& Params) { _Params = Move(Params); }
33 void EmptyParams() { _Params.Empty(); }
34
35 bool HasParams() const
36 {
37 return !_Params.IsEmpty();
38 }
39
41 {
42 return _Params.Num();
43 }
44
46 {
47 return _Params;
48 }
49
51 {
52 const CTypeBase& ParamsType = _FunctionType->GetParamsType();
54 {
55 return (*TupleParamsType)[ParamIndex];
56 }
57 return &ParamsType;
58 }
59
60 const CTypeBase* GetParamsType() const
61 {
62 return ULANG_ENSUREF(_FunctionType, "Querying for a params type, when the function type has not been set.")
63 ? &_FunctionType->GetParamsType()
64 : nullptr;
65 }
66
67 const CTypeBase* GetReturnType() const
68 {
69 return ULANG_ENSUREF(_FunctionType, "Querying for a return type, when the function type has not been set.")
70 ? &_FunctionType->GetReturnType()
71 : nullptr;
72 }
73
75 {
76 return _FunctionType;
77 }
78
80 {
81 return ULANG_ENSUREF(_FunctionType, "Querying for function type flags, when the function type has not been set.") ? _FunctionType->GetEffects() : EffectSets::FunctionDefault;
82 }
83
84 friend bool operator==(const SSignature& Left, const SSignature& Right)
85 {
86 return Left._FunctionType == Right._FunctionType && Left._Params == Right._Params;
87 }
88
89 friend bool operator!=(const SSignature& Left, const SSignature& Right)
90 {
91 return !(Left == Right);
92 }
93
94 // Data members
95
96private:
97 const CFunctionType* _FunctionType = nullptr;
98 ParamDefinitions _Params;
99}; // SSignature
100
101} // namespace uLang
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define ULANG_ENSUREF(expr, format,...)
Definition Common.h:292
Definition SemanticTypes.h:1055
const CTypeBase & GetReturnType() const
Definition SemanticTypes.h:1077
const CTypeBase & GetParamsType() const
Definition SemanticTypes.h:1076
SEffectSet GetEffects() const
Definition SemanticTypes.h:1078
TType * AsNullable()
Definition SemanticTypes.h:233
virtual const CNormalType & GetNormalType() const override
Definition SemanticTypes.h:271
Definition SemanticTypes.h:1008
Base class for all types.
Definition SemanticTypes.h:138
Definition Array.h:51
void Empty(int32_t Slack=0)
Definition Array.h:1322
ULANG_FORCEINLINE bool IsEmpty() const
Definition Array.h:430
ULANG_FORCEINLINE int32_t Num() const
Definition Array.h:402
Definition VVMEngineEnvironment.h:23
ULANG_FORCEINLINE TRemoveReference< T >::Type && Move(T &&Obj)
Definition References.h:86
Definition Effects.h:46
Definition Signature.h:17
bool HasParams() const
Definition Signature.h:35
const CFunctionType * GetFunctionType() const
Definition Signature.h:74
const ParamDefinitions & GetParams() const
Definition Signature.h:45
friend bool operator!=(const SSignature &Left, const SSignature &Right)
Definition Signature.h:89
SEffectSet GetEffects() const
Definition Signature.h:79
const CTypeBase * GetParamType(int32_t ParamIndex) const
Definition Signature.h:50
SSignature()=default
void SetParams(ParamDefinitions &&Params)
Definition Signature.h:32
void SetFunctionType(const CFunctionType *FunctionType)
Definition Signature.h:31
TArray< CDataDefinition * > ParamDefinitions
Definition Signature.h:18
friend bool operator==(const SSignature &Left, const SSignature &Right)
Definition Signature.h:84
int32_t NumParams() const
Definition Signature.h:40
SSignature(const CFunctionType &FunctionType, ParamDefinitions &&Params)
Definition Signature.h:22
const CTypeBase * GetParamsType() const
Definition Signature.h:60
void EmptyParams()
Definition Signature.h:33
const CTypeBase * GetReturnType() const
Definition Signature.h:67