Rogue Wave Views Foundation Package API Reference Guide |
Rogue Wave Views Documentation Home |
Scripting class. More...
#include <ilviews/base/script.h>
Public Member Functions | |
IlvScriptFunction (IlvScriptContext *context, const char *functionName, IlvValueTypeClass *retType, IlInt nParams, IlInt reqParams,...) | |
Constructor. More... | |
virtual IlBoolean | applyValue (const IlvValue &val) |
Apply an accessor. More... | |
virtual IlBoolean | call (IlvValue &retVal, IlInt count, IlvValue *args)=0 |
Defines the function. More... | |
virtual IlvValue & | queryValue (IlvValue &value) const |
Retrieves an accessor value. More... | |
Public Member Functions inherited from IlvValueInterface | |
virtual IlBoolean | changeValue (const IlvValue &val) |
Changes the value of an accessor. More... | |
virtual IlBoolean | changeValues (const IlvValue *values, IlUShort count=0) |
Changes several accessor values simultaneously. More... | |
virtual void | getAccessors (const IlSymbol *const **names, const IlvValueTypeClass *const **types, IlUInt &count) const |
Retrieves the list of available accessors of an object. More... | |
virtual const char * | getName () const |
Returns the name of the instance. The semantic and implementation of this method are defined by concrete subclasses. The default implementation returns 0 . More... | |
virtual void | queryValues (IlvValue *values, IlUShort count) const |
Retrieves multiple accessor values simultaneously. More... | |
Scripting class.
Library: xviews or winviews or mviews (mutually exclusive)
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.
Apply an accessor.
This member function is called by changeValue()
and changeValues()
methods. It must not be called directly.
This method must be overriden by subclasses wishing to add a new accessor modifiable by changeValue()
.
value | The new value of the accessor. |
IlTrue
on success, otherwise IlFalse
. Reimplemented from IlvValueInterface.
|
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. Retrieves an accessor value.
The queryValue()
method can be used in the following way:
This method must be overriden by subclasses wishing to add a new readable accessor.
val | The IlvValue used both to identify the accessor and to store the return value. |
IlvValue
. Reimplemented from IlvValueInterface.
© Copyright 2016, 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.