Gorgon Game Engine
MappedFunction< F_ > Class Template Reference

This class wraps a C++ function into an overload. It can be constructed using MapFunction. More...

Inheritance diagram for MappedFunction< F_ >:
[legend]

Public Member Functions

template<class ... P_>
 MappedFunction (F_ fn, const Scripting::Type *returntype, Scripting::ParameterList parameters, P_ ...tags)
 Constructor. More...
 
virtual Data Call (bool ismethod, const std::vector< Data > &parameters) const override
 Class the stub for this function. More...
 
- Public Member Functions inherited from Function::Overload
 Overload (const Type *returntype, ParameterList parameters, bool stretchlast, bool repeatlast, bool accessible, bool constant, bool returnsref, bool returnsconst, bool implicit)
 A full constructor. More...
 
template<class ... P_>
 Overload (const Type *returntype, ParameterList parameters, P_ ...tags)
 Regular constructor that can take as many tags as needed. More...
 
virtual ~Overload ()
 
const FunctionGetParent () const
 Returns the function this variant belongs. More...
 
const TypeGetReturnType () const
 Returns the type this variant returns. More...
 
bool HasReturnType () const
 Returns whether this variant returns a value. More...
 
bool IsConstant () const
 Returns whether this function is a constant. More...
 
bool IsImplicit () const
 Returns if this variant can be used as implicit conversion. More...
 
bool IsSame (const Overload &var) const
 Compares two variants if they have the same signature. More...
 
bool RepeatLast () const
 Returns if the last parameter of this function should be repeated. More...
 
bool ReturnsConst () const
 This function variant returns a constant. More...
 
bool ReturnsRef () const
 This function variant returns a reference to a value rather than the value itself. More...
 
bool StretchLast () const
 Returns if the last parameter of this function should be stretched. More...
 

Additional Inherited Members

- Public Attributes inherited from Function::Overload
const ParameterListParameters
 The parameters of this overload. More...
 
- Protected Attributes inherited from Function::Overload
bool accessible
 Only meaningful in class member functions. More...
 
bool constant
 Makes this function constant. Only works on member functions. More...
 
bool implicit
 If the parent function is constructor, marks this variant as an implicit type conversion. More...
 
ParameterList parameters
 Modifiable parameters of this overload. More...
 
Functionparent
 The parent function of this variant. More...
 
bool repeatlast
 If true last parameter can be specified any number of times. More...
 
bool returnsconst
 This function variant returns a constant, useful with references. More...
 
bool returnsref
 This function variant returns a reference. More...
 
const Typereturntype
 Return type of this function variant. If nullptr this function does not return a value. More...
 
bool stretchlast
 If true, in console dialect, spaces in the last parameter are not treated as parameter separator as if it is in quotes. More...
 

Detailed Description

template<class F_>
class Gorgon::Scripting::MappedFunction< F_ >

This class wraps a C++ function into an overload. It can be constructed using MapFunction.

Constructor & Destructor Documentation

◆ MappedFunction()

MappedFunction ( F_  fn,
const Scripting::Type returntype,
Scripting::ParameterList  parameters,
P_ ...  tags 
)

Constructor.

Member Function Documentation

◆ Call()

virtual Data Call ( bool  ismethod,
const std::vector< Data > &  parameters 
) const
overridevirtual

Class the stub for this function.

If ismethod parameter is set and method variant exists method variant is called. But if there is no method variant, it simply prints out the return of the function. When ismethod is set, this function will never return a value.

Implements Function::Overload.

References VirtualMachine::Get(), VirtualMachine::GetOutput(), Data::Invalid(), and Function::Overload::parameters.


The documentation for this class was generated from the following file: