Class TCasScriptFunctionHandlers

Unit

Declaration

type TCasScriptFunctionHandlers = class(TObject)

Description

This specifies for each type combination (array of TCasScriptValue classes) and for each function (TCasScriptFunction class) how they should be handled. You can think of this as a table that has a handler for each possible TCasScriptValue sequence and TCasScriptFunction combination.

The idea is to allow programmer to extend KambiScipt by

  1. Defining new types of values for CastleScript: add new TCasScriptValue class, and create handlers for known functions to handle this type.

    It may be comfortable to place these handlers as private methods within your new TCasScriptValue descendant, although this is your private decision.

  2. Defining new functions for CastleScript: add new TCasScriptFunction class, and create handlers for known values to be handled by this function.

    It may be comfortable to place these handlers as private methods within your new TCasScriptFunction descendant, although this is your private decision.

You have a guarantee that every registered here Handler will be called only with AFunction of registstered type and all Arguments matching the array of registered types and satisfying VariableArgumentsCount setting.

As a bonus, this also provides a list of all usable function classes. That's because you have to register at least one handler for each TCasScriptFunction descendant to make this function actually usable, so we know about it here.

Hierarchy

  • TObject
  • TCasScriptFunctionHandlers

Overview

Methods

Public constructor Create;
Public destructor Destroy; override;
Public procedure RegisterHandler( AHandler: TCasScriptFunctionHandler; AFunctionClass: TCasScriptFunctionClass; const AArgumentClasses: array of TCasScriptValueClass; const AVariableArgumentsCount: boolean);
Public function SearchFunctionShortName(const AShortName: string): TCasScriptFunctionClass;

Description

Methods

Public constructor Create;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public procedure RegisterHandler( AHandler: TCasScriptFunctionHandler; AFunctionClass: TCasScriptFunctionClass; const AArgumentClasses: array of TCasScriptValueClass; const AVariableArgumentsCount: boolean);

This item has no description.

Public function SearchFunctionShortName(const AShortName: string): TCasScriptFunctionClass;

Search for function class with matching ShortName. Returns Nil if not found.


Generated by PasDoc 0.16.0-snapshot.