group Classes

Description

Class are what objects are made from. There are a number of functions in this group that allows for creation and manipulation of both objects and classes.

group attributes
function ferite_register_inherited_class() - Registers, creates and returns a class object
function ferite_register_class_function() - Register a function within a class
function ferite_register_class_variable() - Register a variable within a class
function ferite_delete_class() - Clean up and free the memory a class takes up
function ferite_find_class() - Find a class within a namespace
function ferite_find_class_id() - Find a class within a namespace, and return it's unique id
function ferite_delete_class_object() - Dispose of an object, the only part of ferite that should be calling this is the garbage collector.
function ferite_object_get_var() - Get a member variable from an object
function ferite_class_get_var() - Get a member variable from an class
function ferite_object_get_function() - Get a function from an object
function ferite_class_get_function() - Get a function from a class
function ferite_class_has_function() - Check to see if a class has the named function
function ferite_find_function_in_object() - Find a function in an object, go up the inheirtance tree if necessary
function ferite_object_has_var() - Check to see whether an object has a certain variable
function ferite_object_set_var() - Set the value of an objects variable
function ferite_object_call_super() - Call the objects parent class's constructor usefull for writing native classes
function ferite_object_is_sublass() - See if the object is from a subclass of the named class
function ferite_find_parent_constructor() - Get a pointer to the first constructor in a class tree
function ferite_object_add_self_variable_to_params() - Add the important variables to the parameter list for an object based function call
function ferite_class_dup() - Create a complete duplicate of a class

Functions

function ferite_register_inherited_class Click to go up to the list
Registers, creates and returns a class object
Declaration:
    FeriteClass *ferite_register_inherited_class( FeriteScript *script, FeriteNamespace *ns, char *name, char *parent )
Description:
This is the only way to create a class natively.
Parameters:
    Parameter #1: FeriteScript *script - The current script being run
    Parameter #2: FeriteNamespace *ns - The namespace in which the class should be registered
    Parameter #3: char *name - The name of the class eg. Socket
    Parameter #4: char *parent - The name of the parent class, this is the class that will be inherited from, if NULL the class will inherit from the base class 'Obj'.
Returns:
    The newly created class

function ferite_register_class_function Click to go up to the list
Register a function within a class
Declaration:
    int ferite_register_class_function( FeriteScript *script, FeriteClass *klass, FeriteFunction *f )
Description:
It must be noted that the function being passed must not have the super, and self variables within their signitue, this function will handle that automatically
Parameters:
    Parameter #1: FeriteScript *script - The current script
    Parameter #2: FeriteClass *klass - The class to place the function in
    Parameter #3: FeriteFunction *f - The function structure
    Parameter #4: int is_static - Boolean, 0 = not static, 1 = static. Allows the specifcation of whether or not the function has static access within the class
Returns:
    1 if function was registered correctly, 0 otherwise

function ferite_register_class_variable Click to go up to the list
Register a variable within a class
Declaration:
    int ferite_register_class_variable( FeriteScript *script, FeriteClass *klass, FeriteVariable *variable, int is_static )
Parameters:
    Parameter #1: FeriteScript *script - The current script
    Parameter #2: FeriteClass *klass - The class to attach the variable to
    Parameter #3: FeriteVariable *variable - The variable to register
    Parameter #4: int is_static - Boolean, 0 = not static, 1 = static. Allows the specifcation of whether or not the variable has static access within the class
Returns:
    1 on success, 0 otherwise

function ferite_delete_class Click to go up to the list
Clean up and free the memory a class takes up
Declaration:
    void ferite_delete_class( FeriteScript *script, FeriteClass *klass )
Parameters:
    Parameter #1: FeriteScript *script - The current script
    Parameter #2: FeriteClass *klass - The class to be deleted

function ferite_find_class Click to go up to the list
Find a class within a namespace
Declaration:
    FeriteClass *ferite_find_class( FeriteScript *script, FeriteNamespace *ns, char *name )
Parameters:
    Parameter #1: FeriteScript *script - The current script
    Parameter #2: FeriteNamespace *ns - The top level namespace to look in
    Parameter #3: char *name - The name of the class to find.
Returns:
    The class on success or NULL otherwise

function ferite_find_class_id Click to go up to the list
Find a class within a namespace, and return it's unique id
Declaration:
    long ferite_find_class_id( FeriteScript *script, FeriteNamespace *ns, char *name )
Parameters:
    Parameter #1: FeriteScript *script - The current script
    Parameter #2: FeriteNamespace *ns - The top level namespace to look in
    Parameter #3: char *name - The name of the class to find.
Returns:
    The id or 0 otherwise

function ferite_delete_class_object Click to go up to the list
Dispose of an object, the only part of ferite that should be calling this is the garbage collector.
Declaration:
    void ferite_delete_class_object( FeriteObject *object )
Description:
If you want to get rid of an object the accepted method is as follows:

object->refcount = 0;
ferite_check_gc();

This will dispose of the object properly. The object destructor will get called if the objects' class is native.
Parameters:
    Parameter #1: object The - object to be nuked.

function ferite_object_get_var Click to go up to the list
Get a member variable from an object
Declaration:
    FeriteVariable *ferite_object_get_var( FeriteScript *script, FeriteObject *object, char *name )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteObject *object - The object to get the variable from
    Parameter #3: char *name - The name of the member to get
Returns:
    The variable on success, NULL otherwise

function ferite_class_get_var Click to go up to the list
Get a member variable from an class
Declaration:
    FeriteVariable *ferite_class_get_var( FeriteScript *script, FeriteClass *klass, char *name )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteClass *klass - The class to get the variable from
    Parameter #3: char *name - The name of the member to get
Returns:
    The variable on success, NULL otherwise

function ferite_object_get_function Click to go up to the list
Get a function from an object
Declaration:
    FeriteFunction *ferite_object_get_function( FeriteScript *script, FeriteObject *object, char *name )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteObject *object - The object to get the function from
    Parameter #3: char *name - The name of the function
Returns:
    The function on success, NULL otherwise

function ferite_class_get_function Click to go up to the list
Get a function from a class
Declaration:
    FeriteFunction *ferite_class_get_function( FeriteScript *script, FeriteClass *cls, char *name )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteClass *cls - The class to get the function from
    Parameter #3: char *name - The name of the function
Returns:
    The function on success, NULL otherwise

function ferite_class_has_function Click to go up to the list
Check to see if a class has the named function
Declaration:
    int ferite_class_has_function(FeriteScript *script, FeriteClass *cls, char *name)
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteClass *cls - The class to check in
    Parameter #3: char *name - The name of the function
Returns:
    FE_TRUE on success, FE_FALSE otherwise

function ferite_find_function_in_object Click to go up to the list
Find a function in an object, go up the inheirtance tree if necessary
Declaration:
    FeriteFunction *ferite_find_function_in_object( FeriteScript *script, FeriteObject *obj, char *function )
Parameters:
    Parameter #1: FeriteScript *script - The current script
    Parameter #2: FeriteObject *obj - The object to search
    Parameter #3: char *function - The name of the function to find
Returns:
    The function on success, NULL otherwise

function ferite_object_has_var Click to go up to the list
Check to see whether an object has a certain variable
Declaration:
    int ferite_object_has_var(FeriteScript script, FeriteObject obj, char *id)
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteObject *obj - The object to check
    Parameter #3: char *id - The name of the variable
Returns:
    If the variable exists FE_TRUE is returned, otherwise FE_FALSE

function ferite_object_set_var Click to go up to the list
Set the value of an objects variable
Declaration:
    void ferite_object_set_var( FeriteScript script, FeriteObject obj, char *id, FeriteVariable *d_var )
Description:
If the variable exists, the value is updated, otherwise a new variable is added to the objects variables
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteObject *obj - The object whose member is to be set
    Parameter #3: char *name - The name of the variable
    Parameter #4: FeriteVariable *d_var - The data used

function ferite_object_call_super Click to go up to the list
Call the objects parent class's constructor usefull for writing native classes
Declaration:
    void ferite_object_call_super( FeriteScript *script, FeriteObject *object, FeriteVariable **params )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteObject *object - The object on which to call the super class's constructor
    Parameter #3: FeriteVariable **params - The parameters to pass to the function call

function ferite_object_is_sublass Click to go up to the list
See if the object is from a subclass of the named class
Declaration:
    int ferite_object_is_sublass( FeriteObject *obj, char *name )
Parameters:
    Parameter #1: FeriteObject *obj - The object to check
    Parameter #2: char *name - The name of the class
Returns:
    FE_TRUE if the object is, FE_FALSE otherwise

function ferite_find_parent_constructor Click to go up to the list
Get a pointer to the first constructor in a class tree
Declaration:
    FeriteFunction *ferite_find_parent_constructor( FeriteScript *script, FeriteClass *klass )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteClass *klass - The class to start with
Returns:
    A pointer to the function, or NULL otherwise

function ferite_object_add_self_variable_to_params Click to go up to the list
Add the important variables to the parameter list for an object based function call
Declaration:
    FeriteVariable **ferite_object_add_self_variable_to_params( FeriteScript *script, FeriteVariable **param, FeriteVariable *ptr )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteVariable **params - The parameter list to add the variables onto
    Parameter #3: FeriteObject *ptr - The object from which a function is being called
Returns:
    The parameter list

function ferite_class_dup Click to go up to the list
Create a complete duplicate of a class
Declaration:
    FeriteClass *ferite_class_dup( FeriteScript *script, FeriteClass *klass, FeriteNamespace *container )
Parameters:
    Parameter #1: FeriteScript *script - The script
    Parameter #2: FeriteClass *klass - The class to duplicate
    Parameter #3: FeriteNamespace *container - A pointer to the namespace that will hold the class
Returns:
    A pointer to a new FeriteClass structure

Automatically generated at 8:45pm, Wednesday 08 January 2003 by feritedoc.