cppexpose  1.0.0.b785e04f23b8
C++ library for type introspection, reflection, and scripting interface
Public Member Functions | Protected Attributes | List of all members
cppexpose::Function Class Reference

Class representing a callable function. More...

#include <cppexpose/include/cppexpose/function/Function.h>

Inheritance diagram for cppexpose::Function:
Inheritance graph
[legend]

Public Member Functions

 Function (std::unique_ptr< AbstractFunction > &&func=nullptr)
 Constructor. More...
 
 Function (const Function &other)
 Copy constructor. More...
 
virtual ~Function ()
 Destructor. More...
 
Functionoperator= (const Function &other)
 Copy operator. More...
 
bool isEmpty () const
 Check if function is empty. More...
 
Variant call (const std::vector< Variant > &args)
 Call function. More...
 

Protected Attributes

std::unique_ptr< AbstractFunctionm_func
 Function implementation. More...
 

Detailed Description

Class representing a callable function.

Contains a reference to a function, which can be either a global or static function, a method of an object, a lambda function, or an arbitrary function object. A Function object can be copied and duplicated, and the function can be invoked with a list of Variants as arguments (making it usable in an abstract way, e.g., via GUI or scripting).

Constructor & Destructor Documentation

cppexpose::Function::Function ( std::unique_ptr< AbstractFunction > &&  func = nullptr)

Constructor.

Parameters
[in]funcFunction object (can be null)
cppexpose::Function::Function ( const Function other)

Copy constructor.

Parameters
[in]otherFunction to copy
virtual cppexpose::Function::~Function ( )
virtual

Destructor.

Member Function Documentation

Function& cppexpose::Function::operator= ( const Function other)

Copy operator.

Parameters
[in]otherFunction to copy
Returns
Reference to this object
bool cppexpose::Function::isEmpty ( ) const

Check if function is empty.

Returns
'true' if empty, else 'false'
Variant cppexpose::Function::call ( const std::vector< Variant > &  args)

Call function.

Parameters
[in]argsList of arguments as Variants
Returns
Return value of the function

Member Data Documentation

std::unique_ptr<AbstractFunction> cppexpose::Function::m_func
protected

Function implementation.


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