| AngelScript |

Loading...
Searching...
No Matches
List of all members
asITypeInfo Class Referenceabstract
Secondary interfaces

The interface for describing types This interface is used to describe the types in the script engine. More...

## Public Member Functions
Miscellaneous
virtual asIScriptEngine * | GetEngine () const =0
| Returns a pointer to the script engine.
virtual const char * | GetConfigGroup () const =0
| Returns the config group in which the type was registered.
virtual asDWORD | GetAccessMask () const =0
| Returns the access mask for this type.
virtual asIScriptModule * | GetModule () const =0
| Returns the module where the type is declared.
Memory management
virtual int | AddRef () const =0
| Increases the reference counter.
virtual int | Release () const =0
| Decrease reference counter.
Type info
virtual const char * | GetName () const =0
| Returns a temporary pointer to the name of the datatype.
virtual const char * | GetNamespace () const =0
| Return the namespace of the type.
virtual asITypeInfo * | GetBaseType () const =0
| Returns the object type that this type derives from.
virtual bool | DerivesFrom (const asITypeInfo *objType) const =0
| Returns true if the type inherits directly or indirectly from the informed type.
virtual asDWORD | GetFlags () const =0
| Returns the type flags.
virtual asUINT | GetSize () const =0
| Returns the size of the object type.
virtual int | GetTypeId () const =0
| Returns the type id for the object type.
virtual int | GetSubTypeId (asUINT subTypeIndex=0) const =0
| Returns the type id of the template sub type.
virtual asITypeInfo * | GetSubType (asUINT subTypeIndex=0) const =0
| Returns the template subtype, in case it is an object type.
virtual asUINT | GetSubTypeCount () const =0
| Returns the number of template sub types.
Interfaces
virtual asUINT | GetInterfaceCount () const =0
| Returns the number of interfaces implemented.
virtual asITypeInfo * | GetInterface (asUINT index) const =0
| Returns a temporary pointer to the specified interface or null if none are found.
virtual bool | Implements (const asITypeInfo *objType) const =0
| Returns true if the type implements the informed interface type.
Factories
virtual asUINT | GetFactoryCount () const =0
| Returns the number of factory functions for the object type.
virtual asIScriptFunction * | GetFactoryByIndex (asUINT index) const =0
| Returns the factory function by the index.
virtual asIScriptFunction * | GetFactoryByDecl (const char *decl) const =0
| Returns the factory function by the declaration.
Methods
virtual asUINT | GetMethodCount () const =0
| Returns the number of methods for the object type.
virtual asIScriptFunction * | GetMethodByIndex (asUINT index, bool getVirtual=true) const =0
| Returns the method by index.
virtual asIScriptFunction * | GetMethodByName (const char *name, bool getVirtual=true) const =0
| Returns the method by name.
virtual asIScriptFunction * | GetMethodByDecl (const char *decl, bool getVirtual=true) const =0
| Returns the method by declaration.
Properties
virtual asUINT | GetPropertyCount () const =0
| Returns the number of properties that the object contains.
virtual int | GetProperty (asUINT index, const char **name, int *typeId=0, bool *isPrivate=0, bool *isProtected=0, int *offset=0, bool *isReference=0, asDWORD *accessMask=0, int *compositeOffset=0, bool *isCompositeIndirect=0) const =0
| Returns the attributes of the property.
virtual const char * | GetPropertyDeclaration (asUINT index, bool includeNamespace=false) const =0
| Returns the declaration of the property.
Behaviours
virtual asUINT | GetBehaviourCount () const =0
| Returns the number of behaviours.
virtual asIScriptFunction * | GetBehaviourByIndex (asUINT index, asEBehaviours *outBehaviour) const =0
| Returns the function and type of the behaviour.
Child types
virtual asUINT | GetChildFuncdefCount () const =0
| Returns the number of child funcdefs declared in the class.
virtual asITypeInfo * | GetChildFuncdef (asUINT index) const =0
| Returns a child funcdef by index.
virtual asITypeInfo * | GetParentType () const =0
| Returns the parent type if this is a child type.
Enums
virtual asUINT | GetEnumValueCount () const =0
| Returns the number of values defined for the enum type.
virtual const char * | GetEnumValueByIndex (asUINT index, int *outValue) const =0
| Returns the name and value of the enum value for the enum type.
Typedef
virtual int | GetTypedefTypeId () const =0
| Returns the type id that the typedef represents.
Funcdef
virtual asIScriptFunction * | GetFuncdefSignature () const =0
| Returns the function description for the funcdef type.
User data
virtual void * | SetUserData (void *data, asPWORD type=0)=0
| Register the memory address of some user data.
virtual void * | GetUserData (asPWORD type=0) const =0
| Returns the address of the previously registered user data.

## Detailed Description

It can represent object types, funcdefs, typedefs, and enums. To determine which family the type belong to verify the flags.

## Member Function Documentation

## ◆ AddRef()

virtual int asITypeInfo::AddRef | ( |  | ) | const
| pure virtual

Returns
  The number of references to this object.

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

## ◆ DerivesFrom()

virtual bool asITypeInfo::DerivesFrom | ( | const asITypeInfo * | objType | ) | const
| pure virtual

Parameters

  [in] | objType | The potential parent type.

Returns
  True if the type inherits directly or indirectly from the informed type.

## ◆ GetAccessMask()

virtual asDWORD asITypeInfo::GetAccessMask | ( |  | ) | const
| pure virtual

Returns
  The access mask for this type.

## ◆ GetBaseType()

virtual asITypeInfo * asITypeInfo::GetBaseType | ( |  | ) | const
| pure virtual

Returns
  A pointer to the object type that this type derives from.

This method will only return a pointer in case of script classes that derives from another script class.

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

## ◆ GetBehaviourByIndex()

virtual asIScriptFunction * asITypeInfo::GetBehaviourByIndex | ( | asUINT | index,
|  | asEBehaviours * | outBehaviour
| ) |  | const
| pure virtual

Parameters

  [in] | index | The index of the behaviour.
  [out] | outBehaviour | Receives the type of the behaviour.

Returns
  The function of the behaviour, or null on error.

## ◆ GetBehaviourCount()

virtual asUINT asITypeInfo::GetBehaviourCount | ( |  | ) | const
| pure virtual

Returns
  The number of behaviours for this type.

## ◆ GetChildFuncdef()

virtual asITypeInfo * asITypeInfo::GetChildFuncdef | ( | asUINT | index | ) | const
| pure virtual

Returns
  The child funcdef matching the index.

## ◆ GetChildFuncdefCount()

virtual asUINT asITypeInfo::GetChildFuncdefCount | ( |  | ) | const
| pure virtual

Returns
  The number of child funcdefs declared in the class.

## ◆ GetConfigGroup()

virtual const char * asITypeInfo::GetConfigGroup | ( |  | ) | const
| pure virtual

Returns
  The name of the config group, or null if not set.

## ◆ GetEngine()

virtual asIScriptEngine * asITypeInfo::GetEngine | ( |  | ) | const
| pure virtual

Returns
  A pointer to the engine.

## ◆ GetEnumValueByIndex()

virtual const char * asITypeInfo::GetEnumValueByIndex | ( | asUINT | index,
|  | int * | outValue
| ) |  | const
| pure virtual

Parameters

  [in] | index | The index of the enum value.
  [out] | outValue | Receives the value of the enum value.

Returns
  The name of the enum value.

## ◆ GetEnumValueCount()

virtual asUINT asITypeInfo::GetEnumValueCount | ( |  | ) | const
| pure virtual

Returns
  The number of enum values.

## ◆ GetFactoryByDecl()

virtual asIScriptFunction * asITypeInfo::GetFactoryByDecl | ( | const char * | decl | ) | const
| pure virtual

Parameters

  [in] | decl | The declaration of the function

Returns
  The matching factory function or null if there are no matches

## ◆ GetFactoryByIndex()

virtual asIScriptFunction * asITypeInfo::GetFactoryByIndex | ( | asUINT | index | ) | const
| pure virtual

Parameters

  [in] | index | The index of the factory function.

Returns
  The factory function or null if the index is invalid.

## ◆ GetFactoryCount()

virtual asUINT asITypeInfo::GetFactoryCount | ( |  | ) | const
| pure virtual

Returns
  The number of factory functions for this object.

## ◆ GetFlags()

virtual asDWORD asITypeInfo::GetFlags | ( |  | ) | const
| pure virtual

Returns
  A bit mask with the flags from asEObjTypeFlags.

Object types are identified by having the flags asOBJ_REF or asOBJ_VALUE set.

Enums are identified by having the flag asOBJ_ENUM set.

Funcdefs are identified by having the flag asOBJ_FUNCDEF set.

Typedefs are identified by having the flag asOBJ_TYPEDEF set.

Script classes are identified by having the asOBJ_SCRIPT_OBJECT flag set. Interfaces are identified as a script class with a size of 0.

See also
  GetSize

## ◆ GetFuncdefSignature()

virtual asIScriptFunction * asITypeInfo::GetFuncdefSignature | ( |  | ) | const
| pure virtual

Returns
  A pointer to the function description interface, or null if not a funcdef type.

This does not increment the reference count of the returned function interface.

## ◆ GetInterface()

virtual asITypeInfo * asITypeInfo::GetInterface | ( | asUINT | index | ) | const
| pure virtual

Parameters

  [in] | index | The interface index.

Returns
  A pointer to the interface type.

## ◆ GetInterfaceCount()

virtual asUINT asITypeInfo::GetInterfaceCount | ( |  | ) | const
| pure virtual

Returns
  The number of interfaces implemented by this type.

## ◆ GetMethodByDecl()

virtual asIScriptFunction * asITypeInfo::GetMethodByDecl | ( | const char * | decl,
|  | bool | getVirtual = `true`
| ) |  | const
| pure virtual

Parameters

  [in] | decl | The method signature.
  [in] | getVirtual | Set to true if the virtual method or the real method should be retrieved.

Returns
  The method or null on error.

This method should be used to retrieve the script method for the object that you wish to execute. The method is then sent to the context's Prepare method.

The method will find the script method with the exact same declaration.

## ◆ GetMethodByIndex()

virtual asIScriptFunction * asITypeInfo::GetMethodByIndex | ( | asUINT | index,
|  | bool | getVirtual = `true`
| ) |  | const
| pure virtual

Parameters

  [in] | index | The index of the method.
  [in] | getVirtual | Set to true if the virtual method or the real method should be retrieved.

Returns
  The method or null on error.

This method should be used to retrieve the script method for the object that you wish to execute. The method is then sent to the context's Prepare method.

By default this returns the virtual method for script classes. This will allow you to call the virtual method on classes, and rely on the polymorphism to call the correct implementation. If you wish to inspect the real method, then you should set the second parameter to false to retrieve the real method.

## ◆ GetMethodByName()

virtual asIScriptFunction * asITypeInfo::GetMethodByName | ( | const char * | name,
|  | bool | getVirtual = `true`
| ) |  | const
| pure virtual

Parameters

  [in] | name | The name of the method.
  [in] | getVirtual | Set to true if the virtual method or the real method should be retrieved.

Returns
  Tthe method or null in case of error

This method should be used to retrieve the script method for the object that you wish to execute. The method is then sent to the context's Prepare method.

## ◆ GetMethodCount()

virtual asUINT asITypeInfo::GetMethodCount | ( |  | ) | const
| pure virtual

Returns
  The number of methods for this object.

## ◆ GetModule()

virtual asIScriptModule * asITypeInfo::GetModule | ( |  | ) | const
| pure virtual

Returns
  The module where the type is declared.

The returned value can be null if the module doesn't exist anymore, or the type is not owned by any module, i.e. registered by the application.

## ◆ GetName()

virtual const char * asITypeInfo::GetName | ( |  | ) | const
| pure virtual

Returns
  A null terminated string with the name of the object type.

## ◆ GetNamespace()

virtual const char * asITypeInfo::GetNamespace | ( |  | ) | const
| pure virtual

Returns
  The namespace of the type, or null if not defined.

If the namespace is not defined it means that this is a child type.

## ◆ GetParentType()

virtual asITypeInfo * asITypeInfo::GetParentType | ( |  | ) | const
| pure virtual

Returns
  The parent type if this is a child type.

## ◆ GetProperty()

virtual int asITypeInfo::GetProperty | ( | asUINT | index,
|  | const char ** | name,
|  | int * | typeId = `0`,
|  | bool * | isPrivate = `0`,
|  | bool * | isProtected = `0`,
|  | int * | offset = `0`,
|  | bool * | isReference = `0`,
|  | asDWORD * | accessMask = `0`,
|  | int * | compositeOffset = `0`,
|  | bool * | isCompositeIndirect = `0`
| ) |  | const
| pure virtual

Parameters

  [in] | index | The index of the property
  [out] | name | The name of the property
  [out] | typeId | The type of the property
  [out] | isPrivate | Whether the property is private or not
  [out] | isProtected | Whether the property is protected or not
  [out] | offset | The offset into the object where the property is stored
  [out] | isReference | True if the property is not stored inline
  [out] | accessMask | The access mask of the property
  [out] | compositeOffset | The offset to composite type if used
  [out] | isCompositeIndirect | Set to false if the composite type is inline

Returns
  A negative value on error

Return values

  asINVALID_ARG | The index is out of bounds

## ◆ GetPropertyCount()

virtual asUINT asITypeInfo::GetPropertyCount | ( |  | ) | const
| pure virtual

Returns
  The number of member properties of the script object.

## ◆ GetPropertyDeclaration()

virtual const char * asITypeInfo::GetPropertyDeclaration | ( | asUINT | index,
|  | bool | includeNamespace = `false`
| ) |  | const
| pure virtual

Parameters

  [in] | index | The index of the property
  [in] | includeNamespace | Set to true if the namespace should be included in the declaration.

Returns
  The declaration of the property, or null on error.

## ◆ GetSize()

virtual asUINT asITypeInfo::GetSize | ( |  | ) | const
| pure virtual

Returns
  The number of bytes necessary to store instances of this type.

Application registered reference types doesn't store this information, as the script engine doesn't allocate memory for these itself.

## ◆ GetSubType()

virtual asITypeInfo * asITypeInfo::GetSubType | ( | asUINT | subTypeIndex = `0` | ) | const
| pure virtual

Parameters

  [in] | subTypeIndex | The zero based index of the template sub type.

Returns
  The type info of the template sub type, or null if the template subtype is a primitive.

## ◆ GetSubTypeCount()

virtual asUINT asITypeInfo::GetSubTypeCount | ( |  | ) | const
| pure virtual

Returns
  The number of template sub types.

## ◆ GetSubTypeId()

virtual int asITypeInfo::GetSubTypeId | ( | asUINT | subTypeIndex = `0` | ) | const
| pure virtual

Parameters

  [in] | subTypeIndex | The zero based index of the template sub type.

Returns
  The type id of the template sub type, or a negative value on error.

Return values

  asERROR | The type is not a template type.

## ◆ GetTypedefTypeId()

virtual int asITypeInfo::GetTypedefTypeId | ( |  | ) | const
| pure virtual

Returns
  The type id that the typedef represents.

## ◆ GetTypeId()

virtual int asITypeInfo::GetTypeId | ( |  | ) | const
| pure virtual

Returns
  The type id for the object type.

## ◆ GetUserData()

virtual void * asITypeInfo::GetUserData | ( | asPWORD | type = `0` | ) | const
| pure virtual

Parameters

  [in] | type | An identifier used to identify which user data to get.

Returns
  The pointer to the user data.

## ◆ Implements()

virtual bool asITypeInfo::Implements | ( | const asITypeInfo * | objType | ) | const
| pure virtual

Parameters

  [in] | objType | The interface type.

Returns
  True if the type implements the informed interface type.

## ◆ Release()

virtual int asITypeInfo::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 * asITypeInfo::SetUserData | ( | void * | data,
|  | asPWORD | type = `0`
| ) |  |
| pure virtual

Parameters

  [in] | data | A pointer to the user data.
  [in] | type | An identifier used to identify which user data to set.

Returns
  The previous pointer stored in the object type.

This method allows the application to associate a value, e.g. a pointer, with the object type instance. Multiple different values can be defined where the type argument identifies which is referred to.

The user data types identifiers between 1000 and 1999 are reserved for use by official add-ons.

Optionally, a callback function can be registered to clean up the user data when the object type is destroyed.

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

- angelscript.h