Difference between revisions of "DISPATCH METHOD()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
m (Text replace - "lianjaapi.h" to "lianja_api.h")
 
Line 7: Line 7:
 
==SYNOPSIS==
 
==SYNOPSIS==
 
<code lang="c">
 
<code lang="c">
#include "lianjaapi.h"
+
#include "lianja_api.h"
  
 
DISPATCH_METHOD(classname, methodname)
 
DISPATCH_METHOD(classname, methodname)
Line 38: Line 38:
  
 
<code lang="c">
 
<code lang="c">
#include "lianjaapi.h"
+
#include "lianja_api.h"
  
 
DEFINE_CLASS(clsMyClass)
 
DEFINE_CLASS(clsMyClass)

Latest revision as of 07:25, 11 April 2013

PURPOSE

A macro to dispatch a method passed to the object

SYNONYM

None

SYNOPSIS

#include "lianja_api.h"
 
DISPATCH_METHOD(classname, methodname)
 
<input parameters>
constant		classname;	/* class name that contains the method	*/
constant		methodname;	/* method name to dispatch 		*/
 
<output parameters>
none

DESCRIPTION

The DISPATCH_METHOD() macro is used to dispatch a method passed to the object. This macro should always be placed after the DISPATCH_FACTORY() macro in each defined class. After a method is dispatched by this macro, execution is returned to Lianja.

EXAMPLE

The following example adds two DISPATCH_METHOD() macros for the constructor and destructor methods to a class called clsMyClass.

Example Lianja script:

// The constructor is called when the object is created
test = newobject("myclass") 
? type("test")
// The destructor is called when the object is released
release test

Example in 'C' object:

#include "lianja_api.h"
 
DEFINE_CLASS(clsMyClass)
{
	/* Dispatch factory methods and return */
	DISPATCH_FACTORY();
 
	/* Dispatch constructor and return */
	DISPATCH_METHOD(clsMyClass, Constructor);
 
	/* Dispatch destructor and return */
	DISPATCH_METHOD(clsMyClass, Destructor);
}

SEE ALSO

DEFINE_CLASS(), DEFINE_METHOD(), DEFINE_PROPERTYGET(), DEFINE_PROPERTYSET(), DISPATCH_FACTORY(), DISPATCH_PROPGET(), DISPATCH_PROPSET(), OBJECT_ASSIGN(), OBJECT_DELETE(), OBJECT_GETARG(), OBJECT_GETARGC(), OBJECT_GETDATA(), OBJECT_GETOBJECT(), OBJECT_GETPARAMETER(), OBJECT_GETPROPERTY(), OBJECT_GETTYPE(), OBJECT_GETVALUE(), OBJECT_NEW(), OBJECT_RETERROR(), OBJECT_RETPROPERTY(), OBJECT_RETRESULT(), OBJECT_SETARG(), OBJECT_SETDATA(), OBJECT_SETPROPERTY()