|
cxWidgets 1.0
|
A more intelligent function pointer, which can run a function with. More...
#include <cxFunction.h>


Public Member Functions | |
| cxFunction2 (funcPtr2 pFuncPtr=nullptr, void *pParam1=nullptr, void *pParam2=nullptr, bool pUseReturnVal=false, bool pExitAfterRun=false, bool pRunOnLeaveFunction=true) | |
| Default constructor. All parameters have default values. | |
| virtual | ~cxFunction2 () |
| virtual bool | functionIsSet () const override |
| void | setFunction (funcPtr2 pFuncPtr) |
| funcPtr2 | getFunction () const |
| Accessor for the internal function pointer. | |
| void | setParams (void *pParam1, void *pParam2) |
| void | setParam1 (void *pParam) |
| void | setParam2 (void *pParam) |
| void * | getParam1 () const |
| void * | getParam2 () const |
| virtual std::string | runFunction () const override |
| virtual void * | getFuncPtr () const override |
| virtual std::string | cxTypeStr () const override |
| Returns the name of the cxWidgets class, "cxFunction2". This can be. | |
Public Member Functions inherited from cx::cxFunction | |
| cxFunction (bool pUseReturnVal, bool pExitAfterRun, bool pRunOnLeaveFunction) | |
| Constructor. | |
| virtual | ~cxFunction () |
| virtual bool | getUseReturnVal () const |
| Accessor for whether the caller should use the return value. | |
| virtual void | setUseReturnVal (bool pUseReturnVal) |
| Setter for whether or not the caller should make use of the return value. | |
| virtual bool | getExitAfterRun () const |
| Accessor for whether the caller should exit after the function. | |
| virtual void | setExitAfterRun (bool pExitAfterRun) |
| Setter for whether or not the caller should quit what. | |
| virtual bool | getRunOnLeaveFunction () const |
| Accessor for whether the caller should run its onLeave function. | |
| virtual void | setRunOnLeaveFunction (bool pRunOnLeaveFunction) |
| Setter for whether or not the caller should run its. | |
A more intelligent function pointer, which can run a function with.
2 parameters. This is used for running external code for an event
(such as a keypress, etc.). This class also stores whether the
function's return value should be used. Note that the function must
have the following signature:
string func(void*, void*)
The parameters are void pointers because it can't be known by this class what types of objects your functions will need. This class lets you set the function pointer, a boolean to signify whether the caller should make use of the return value, and also set the parameters to be passed to the function. This class was originally intended for use with cxInput and cxMultiLineInput, so this class also has a boolean to specify whether the input should exit its input upon exit of the function.
|
explicit |
Default constructor. All parameters have default values.
available. Note that function must have this signature:
string func(void*, void*)
| pFuncPtr | Pointer to the function to be run. Defaults to nullptr. |
| pParam1 | The first parameter to pass to the function when it's run - This is a void pointer. |
| pParam2 | The second parameter to pass to the function when it's run - This is a void pointer. |
| pUseReturnVal | Indicates whether caller will make use of return value. Defaults to false |
| pExitAfterRun | Whether or not the caller should exit from its input loop once the function is done. Defaults to false. |
| pRunOnLeaveFunction | Whether or not the caller should run its onLeave function when it exits (useful if pExitAfterRun is true). This defaults to true. |
|
virtual |
Destructor
|
overridevirtual |
Returns the name of the cxWidgets class, "cxFunction2". This can be.
used to determine the type of cxWidgets object that deriving
classes derive from in applications.
Implements cx::cxFunction.
|
overridevirtual |
Returns whether the internal funtion pointer is set.
Implements cx::cxFunction.
|
overridevirtual |
Implements cx::cxFunction.
| funcPtr2 cx::cxFunction2::getFunction | ( | ) | const |
Accessor for the internal function pointer.
Referenced by cx::cxMultiLineInput::usingBuiltInOnKeyFunction(), and cx::cxMultiLineInput::usingBuiltInValidator().
| void * cx::cxFunction2::getParam1 | ( | ) | const |
Accessor for the first function parameter
| void * cx::cxFunction2::getParam2 | ( | ) | const |
Accessor for the second function pointer
|
overridevirtual |
If function pointer is not null, runs the function and returns its return value; If function pointer is nullptr, returns empty string
Implements cx::cxFunction.
| void cx::cxFunction2::setFunction | ( | funcPtr2 | pFuncPtr | ) |
Sets the internal function pointer
| pFuncPtr | The function to which to point |
| void cx::cxFunction2::setParam1 | ( | void * | pParam | ) |
Sets the first parameter
| pParam | First parameter to pass to function |
| void cx::cxFunction2::setParam2 | ( | void * | pParam | ) |
Sets the second parameter
| pParam | Second parameter to pass to function |
| void cx::cxFunction2::setParams | ( | void * | pParam1, |
| void * | pParam2 | ||
| ) |
Sets the parameters to pass to the function.
| pParam1 | First parameter to pass to function |
| pParam2 | Second parameter to pass to function |