cppexpose
1.0.0.b785e04f23b8
C++ library for type introspection, reflection, and scripting interface
|
Class representing a callable function. More...
#include <cppexpose/include/cppexpose/function/Function.h>
Public Member Functions | |
Function (std::unique_ptr< AbstractFunction > &&func=nullptr) | |
Constructor. More... | |
Function (const Function &other) | |
Copy constructor. More... | |
virtual | ~Function () |
Destructor. More... | |
Function & | operator= (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< AbstractFunction > | m_func |
Function implementation. More... | |
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).
cppexpose::Function::Function | ( | std::unique_ptr< AbstractFunction > && | func = nullptr | ) |
Constructor.
[in] | func | Function object (can be null) |
cppexpose::Function::Function | ( | const Function & | other | ) |
Copy constructor.
[in] | other | Function to copy |
|
virtual |
Destructor.
bool cppexpose::Function::isEmpty | ( | ) | const |
Check if function is empty.
Variant cppexpose::Function::call | ( | const std::vector< Variant > & | args | ) |
Call function.
[in] | args | List of arguments as Variants |
|
protected |
Function implementation.