AngelScript
asIScriptFunction Class Referenceabstract

The interface for a script function description.

Public Member Functions

Miscellaneous
virtual asIScriptEngineGetEngine () const =0
 Returns a pointer to the script engine. More...
 
virtual int AddRef () const =0
 Increases the reference counter. More...
 
virtual int Release () const =0
 Decrease reference counter. More...
 
virtual int GetId () const =0
 Returns the id of the function. More...
 
virtual asEFuncType GetFuncType () const =0
 Returns the type of the function. More...
 
virtual const char * GetModuleName () const =0
 Returns the name of the module where the function was implemented. More...
 
virtual asIScriptModuleGetModule () const =0
 Returns the module where the function is declared. More...
 
virtual const char * GetScriptSectionName () const =0
 Returns the name of the script section where the function was implemented. More...
 
virtual const char * GetConfigGroup () const =0
 Returns the name of the config group in which the function was registered. More...
 
virtual asDWORD GetAccessMask () const =0
 Returns the access mast of the function. More...
 
virtual void * GetAuxiliary () const =0
 Returns the auxiliary object registered with the function. More...
 
Function signature
virtual asITypeInfoGetObjectType () const =0
 Returns the object type for class or interface method. More...
 
virtual const char * GetObjectName () const =0
 Returns the name of the object for class or interface methods. More...
 
virtual const char * GetName () const =0
 Returns the name of the function or method. More...
 
virtual const char * GetNamespace () const =0
 Returns the namespace of the function. More...
 
virtual const char * GetDeclaration (bool includeObjectName=true, bool includeNamespace=false, bool includeParamNames=false) const =0
 Returns the function declaration. More...
 
virtual bool IsReadOnly () const =0
 Returns true if the class method is read-only. More...
 
virtual bool IsPrivate () const =0
 Returns true if the class method is private. More...
 
virtual bool IsProtected () const =0
 Returns true if the class method is protected. More...
 
virtual bool IsFinal () const =0
 Returns true if the method is final. More...
 
virtual bool IsOverride () const =0
 Returns true if the method is meant to override a method in the base class. More...
 
virtual bool IsShared () const =0
 Returns true if the function is shared. More...
 
virtual bool IsExplicit () const =0
 Returns true if the function is declared as 'explicit'. More...
 
virtual bool IsProperty () const =0
 Returns true if the function is declared as 'property'. More...
 
virtual asUINT GetParamCount () const =0
 Returns the number of parameters for this function. More...
 
virtual int GetParam (asUINT index, int *typeId, asDWORD *flags=0, const char **name=0, const char **defaultArg=0) const =0
 Returns the type id of the specified parameter. More...
 
virtual int GetReturnTypeId (asDWORD *flags=0) const =0
 Returns the type id of the return type. More...
 
Type id for function pointers
virtual int GetTypeId () const =0
 Returns the type id representing a function pointer for this function. More...
 
virtual bool IsCompatibleWithTypeId (int typeId) const =0
 Checks if the given type id can represent this function. More...
 
Delegates
virtual void * GetDelegateObject () const =0
 Returns the object for the delegate. More...
 
virtual asITypeInfoGetDelegateObjectType () const =0
 Returns the type of the delegated object. More...
 
virtual asIScriptFunctionGetDelegateFunction () const =0
 Returns the function for the delegate. More...
 
Debug information
virtual asUINT GetVarCount () const =0
 Returns the number of local variables in the function. More...
 
virtual int GetVar (asUINT index, const char **name, int *typeId=0) const =0
 Returns information about a local variable. More...
 
virtual const char * GetVarDecl (asUINT index, bool includeNamespace=false) const =0
 Returns the declaration of a local variable. More...
 
virtual int FindNextLineWithCode (int line) const =0
 Returns the next line number with code. More...
 
JIT compilation
virtual asDWORDGetByteCode (asUINT *length=0)=0
 Returns the byte code buffer and length. More...
 
User data
virtual void * SetUserData (void *userData, asPWORD type=0)=0
 Register the memory address of some user data. More...
 
virtual void * GetUserData (asPWORD type=0) const =0
 Returns the address of the previously registered user data. More...
 

Member Function Documentation

◆ AddRef()

virtual int asIScriptFunction::AddRef ( ) const
pure virtual
Returns
The number of references to this object.

Call this method when storing an additional reference to the object.

◆ FindNextLineWithCode()

virtual int asIScriptFunction::FindNextLineWithCode ( int  line) const
pure virtual
Parameters
[in]lineA line number
Returns
The number of the next line with code, or a negative value if the line is outside the function.

◆ GetAccessMask()

virtual asDWORD asIScriptFunction::GetAccessMask ( ) const
pure virtual
Returns
The access mask of the function.

◆ GetAuxiliary()

virtual void* asIScriptFunction::GetAuxiliary ( ) const
pure virtual
Returns
The auxiliary object registered with the function.

◆ GetByteCode()

virtual asDWORD* asIScriptFunction::GetByteCode ( asUINT length = 0)
pure virtual
Parameters
[out]lengthThe length of the byte code buffer in DWORDs
Returns
A pointer to the byte code buffer, or 0 if this is not a script function.

This function is used by the asIJITCompiler to obtain the byte code buffer for building the native machine code representation.

◆ GetConfigGroup()

virtual const char* asIScriptFunction::GetConfigGroup ( ) const
pure virtual
Returns
The name of the config group, or null if not in any group.

◆ GetDeclaration()

virtual const char* asIScriptFunction::GetDeclaration ( bool  includeObjectName = true,
bool  includeNamespace = false,
bool  includeParamNames = false 
) const
pure virtual
Parameters
[in]includeObjectNameIndicate whether the object name should be prepended to the function name
[in]includeNamespaceIndicates whether the namespace should be prepended to the function name and types
[in]includeParamNamesIndicates whether parameter names should be added to the declaration
Returns
A null terminated string with the function declaration.

The parameter names are not stored for virtual methods. If you want to know the name of parameters to class methods, be sure to get the actual implementation rather than the virtual method.

The namespace will always be included for types that are declared in a different namespace than the function itself.

◆ GetDelegateFunction()

virtual asIScriptFunction* asIScriptFunction::GetDelegateFunction ( ) const
pure virtual
Returns
A pointer to the delegated function

◆ GetDelegateObject()

virtual void* asIScriptFunction::GetDelegateObject ( ) const
pure virtual
Returns
A pointer to the delegated object

◆ GetDelegateObjectType()

virtual asITypeInfo* asIScriptFunction::GetDelegateObjectType ( ) const
pure virtual
Returns
A pointer to the object type of the delegated object.

◆ GetEngine()

virtual asIScriptEngine* asIScriptFunction::GetEngine ( ) const
pure virtual
Returns
A pointer to the engine.

◆ GetFuncType()

virtual asEFuncType asIScriptFunction::GetFuncType ( ) const
pure virtual
Returns
The type of the function

◆ GetId()

virtual int asIScriptFunction::GetId ( ) const
pure virtual
Returns
The id of the function

◆ GetModule()

virtual asIScriptModule* asIScriptFunction::GetModule ( ) const
pure virtual
Returns
The module where the function is declared.

The returned value can be null if the module doesn't exist anymore.

◆ GetModuleName()

virtual const char* asIScriptFunction::GetModuleName ( ) const
pure virtual
Returns
A null terminated string with the module name.

◆ GetName()

virtual const char* asIScriptFunction::GetName ( ) const
pure virtual
Returns
A null terminated string with the name of the function.

◆ GetNamespace()

virtual const char* asIScriptFunction::GetNamespace ( ) const
pure virtual
Returns
The namespace of the function, or null if not defined.

◆ GetObjectName()

virtual const char* asIScriptFunction::GetObjectName ( ) const
pure virtual
Returns
A null terminated string with the name of the object type if this a method.

◆ GetObjectType()

virtual asITypeInfo* asIScriptFunction::GetObjectType ( ) const
pure virtual
Returns
A pointer to the object type interface if this is a method.

This does not increase the reference count of the returned object type.

◆ GetParam()

virtual int asIScriptFunction::GetParam ( asUINT  index,
int *  typeId,
asDWORD flags = 0,
const char **  name = 0,
const char **  defaultArg = 0 
) const
pure virtual
Parameters
[in]indexThe zero based parameter index.
[out]typeIdThe typeId of the parameter.
[out]flagsA combination of asETypeModifiers.
[out]nameThe name of the parameter (or null if not defined).
[out]defaultArgThe default argument expression (or null if not defined).
Returns
A negative value on error.
Return values
asINVALID_ARGThe index is out of bounds.

The parameter names are not stored for virtual methods. If you want to know the name of parameters to class methods, be sure to get the actual implementation rather than the virtual method.

◆ GetParamCount()

virtual asUINT asIScriptFunction::GetParamCount ( ) const
pure virtual
Returns
The number of parameters.

◆ GetReturnTypeId()

virtual int asIScriptFunction::GetReturnTypeId ( asDWORD flags = 0) const
pure virtual
Parameters
[out]flagsA combination of asETypeModifiers.
Returns
The type id of the return type.

◆ GetScriptSectionName()

virtual const char* asIScriptFunction::GetScriptSectionName ( ) const
pure virtual
Returns
A null terminated string with the script section name where the function was implemented.

The returned pointer is null when the function doesn't originate from a script file, i.e. a registered function or an auto-generated script function. It can also be null if the information has been removed, e.g. when saving bytecode without debug info.

◆ GetTypeId()

virtual int asIScriptFunction::GetTypeId ( ) const
pure virtual
Returns
The type id that represents a function pointer for this function

◆ GetUserData()

virtual void* asIScriptFunction::GetUserData ( asPWORD  type = 0) const
pure virtual
Parameters
[in]typeAn identifier specifying the user data to set.
Returns
The pointer to the user data.

◆ GetVar()

virtual int asIScriptFunction::GetVar ( asUINT  index,
const char **  name,
int *  typeId = 0 
) const
pure virtual
Parameters
[in]indexThe zero based index of the local variable
[out]nameReceives the name of the variable
[out]typeIdReceives the typeId of the variable
Returns
A negative value on error
Return values
asINVALID_ARGThe index is out of range
asNOT_SUPPORTEDThe function is not a script function

◆ GetVarCount()

virtual asUINT asIScriptFunction::GetVarCount ( ) const
pure virtual
Returns
The number of local variables in the function

◆ GetVarDecl()

virtual const char* asIScriptFunction::GetVarDecl ( asUINT  index,
bool  includeNamespace = false 
) const
pure virtual
Parameters
[in]indexThe zero based index of the local variable
[in]includeNamespaceSet to true if the namespace should be included in the declaration.
Returns
The declaration string, or null on error

◆ IsCompatibleWithTypeId()

virtual bool asIScriptFunction::IsCompatibleWithTypeId ( int  typeId) const
pure virtual
Returns
Returns true if the type id can represent this function.

◆ IsExplicit()

virtual bool asIScriptFunction::IsExplicit ( ) const
pure virtual
Returns
True if the function is explicit.

◆ IsFinal()

virtual bool asIScriptFunction::IsFinal ( ) const
pure virtual
Returns
True if the method is final.

◆ IsOverride()

virtual bool asIScriptFunction::IsOverride ( ) const
pure virtual
Returns
True if the method is meant to override a method in the base class.

◆ IsPrivate()

virtual bool asIScriptFunction::IsPrivate ( ) const
pure virtual
Returns
True if the class method is private

◆ IsProperty()

virtual bool asIScriptFunction::IsProperty ( ) const
pure virtual
Returns
True if the function is a property accessor.

◆ IsProtected()

virtual bool asIScriptFunction::IsProtected ( ) const
pure virtual
Returns
True if the class method is protected

◆ IsReadOnly()

virtual bool asIScriptFunction::IsReadOnly ( ) const
pure virtual
Returns
True if the class method is read-only

◆ IsShared()

virtual bool asIScriptFunction::IsShared ( ) const
pure virtual
Returns
True if the function is shared.

◆ Release()

virtual int asIScriptFunction::Release ( ) const
pure virtual
Returns
The number of references to this object.

Call this method when you will no longer use the references that you own.

◆ SetUserData()

virtual void* asIScriptFunction::SetUserData ( void *  userData,
asPWORD  type = 0 
)
pure virtual
Parameters
[in]userDataA pointer to the user data.
[in]typeAn identifier specifying the user data to set.
Returns
The previous pointer stored in the context.

This method allows the application to associate a value, e.g. a pointer, with the context instance.

The type values 1000 through 1999 are reserved for use by the official add-ons.

Optionally, a callback function can be registered to clean up the user data when the function is destroyed. As the callback is registered with the engine, it is only necessary to do it once.


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