Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Scripting class. More...
#include <ilviews/base/script.h>
Inherits IlvValueInterface.
Public Member Functions | |
IlvScriptFunction (IlvScriptContext *context, const char *functionName, IlvValueTypeClass *retType, IlInt nParams, IlInt reqParams,...) | |
Constructor. More... | |
virtual IlBoolean | call (IlvValue &retVal, IlInt count, IlvValue *args)=0 |
Defines the function. More... | |
Scripting class.
Library: display
The class IlvScriptFunction
is an abstract class that you must derive to access C++ code from scripting languages.
IlvScriptContext
. IlvScriptFunction::IlvScriptFunction | ( | IlvScriptContext * | context, |
const char * | functionName, | ||
IlvValueTypeClass * | retType, | ||
IlInt | nParams, | ||
IlInt | reqParams, | ||
... | |||
) |
Constructor.
This constructor initializes a new instance of a subtype of the class IlvScriptFunction
declaring a new function. This function can be accessed from the scripting language that you use, in the indicated context.
context | The script context where this function is defined. |
functionName | The name of this new function. The string is copied. |
retType | A pointer to the instance of the return type of this function. |
nParams | The maximum number of parameters that this function can take. |
reqParams | Specifies how many parameters are actually required, the other parameters being optional. |
The ellipses must be replaced with pairs of nParams
parameters. The first of the two parameters is a pointer to the expected parameter type, and the second is a string that names the parameter. The following function, for example, takes three parameters of the integer type and an optional parameter. It returns an integer.
|
pure virtual |
Defines the function.
This member function is the only one that must be implemented to perform the task for which the scripting function is designed. It is called by the script interpreter with the parameters provided by the user (the number and the types of arguments are implicitly checked). Let us suppose that the scripting function presented above adds the values of the first two parameters and divides the result by the third argument, if any. Here is how we would implement the call
function:
retVal | The return value of this function. |
count | The number of parameters provided to this function. |
args | An array of at least count values that are used as the parameters of the function. |
IlTrue
on success and IlFalse
on failure. © Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.